Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup test: fs.link() test runs on same device
  • Loading branch information
drewfish committed Jan 25, 2016
commit f90c991749f452c7147e7128182abbc2443f745f
10 changes: 3 additions & 7 deletions test/parallel/test-fs-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ const fs = require('fs');
common.refreshTmpDir();

// test creating and reading hard link
const srcPath = path.join(common.fixturesDir, 'cycles', 'root.js');
const srcContent = fs.readFileSync(srcPath, 'utf8');
const tmpSrcPath = path.join(common.tmpDir, 'root.js');
const srcPath = path.join(common.tmpDir, 'hardlink-target.txt');
const dstPath = path.join(common.tmpDir, 'link1.js');
fs.writeFileSync(srcPath, 'hello world');

const callback = function(err) {
if (err) throw err;
const dstContent = fs.readFileSync(dstPath, 'utf8');
assert.strictEqual(srcContent, dstContent);
assert.strictEqual('hello world', dstContent);
};

// copy source file to same directory to avoid cross-filesystem issues
fs.writeFileSync(tmpSrcPath, srcContent, 'utf8');

fs.link(srcPath, dstPath, common.mustCall(callback));

// test error outputs
Expand Down