mirror of https://github.com/lukechilds/node.git
Browse Source
If the symlink portion of the test was being skipped due to a combination of OS support and user privileges, then an assertion would always fail. This fixes that problem, improves assertion error reporting and splits the test to make it clear that it is a test for links and symlinks. Fixes: https://github.com/nodejs/node/issues/3311 PR-URL: https://github.com/nodejs/node/pull/3418 Reviewed-By: Johan Bergström <bugs@bergstroem.nu>process-exit-stdio-flushing
Rich Trott
9 years ago
2 changed files with 55 additions and 62 deletions
@ -0,0 +1,20 @@ |
|||||
|
'use strict'; |
||||
|
const common = require('../common'); |
||||
|
const assert = require('assert'); |
||||
|
const path = require('path'); |
||||
|
const fs = require('fs'); |
||||
|
|
||||
|
common.refreshTmpDir(); |
||||
|
|
||||
|
// test creating and reading hard link
|
||||
|
const srcPath = path.join(common.fixturesDir, 'cycles', 'root.js'); |
||||
|
const dstPath = path.join(common.tmpDir, 'link1.js'); |
||||
|
|
||||
|
const callback = function(err) { |
||||
|
if (err) throw err; |
||||
|
const srcContent = fs.readFileSync(srcPath, 'utf8'); |
||||
|
const dstContent = fs.readFileSync(dstPath, 'utf8'); |
||||
|
assert.strictEqual(srcContent, dstContent); |
||||
|
}; |
||||
|
|
||||
|
fs.link(srcPath, dstPath, common.mustCall(callback)); |
Loading…
Reference in new issue