Skip to content

Commit

Permalink
test: don't assume a certain folder structure
Browse files Browse the repository at this point in the history
A few tests assumed that temp dirs always lived in the same
parent folder as fixtures. Make these use `common.tmpDir` instead.

PR-URL: #3325
Reviewed-By: Joao Reis <reis@janeasystems.com>
  • Loading branch information
jbergstroem authored and Fishrock123 committed Jan 6, 2016
1 parent 55c6946 commit 5110e4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 9 additions & 9 deletions test/parallel/test-fs-realpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ function test_deep_symlink_mix(callback) {
}

/*
/tmp/node-test-realpath-f1 -> ../tmp/node-test-realpath-d1/foo
/tmp/node-test-realpath-d1 -> ../node-test-realpath-d2
/tmp/node-test-realpath-d2/foo -> ../node-test-realpath-f2
/tmp/node-test-realpath-f1 -> $tmpDir/node-test-realpath-d1/foo
/tmp/node-test-realpath-d1 -> $tmpDir/node-test-realpath-d2
/tmp/node-test-realpath-d2/foo -> $tmpDir/node-test-realpath-f2
/tmp/node-test-realpath-f2
-> /node/test/fixtures/nested-index/one/realpath-c
/node/test/fixtures/nested-index/one/realpath-c
-> /node/test/fixtures/nested-index/two/realpath-c
/node/test/fixtures/nested-index/two/realpath-c -> ../../cycles/root.js
/node/test/fixtures/nested-index/two/realpath-c -> $tmpDir/cycles/root.js
/node/test/fixtures/cycles/root.js (hard)
*/
var entry = tmp('node-test-realpath-f1');
Expand All @@ -289,16 +289,16 @@ function test_deep_symlink_mix(callback) {
fs.mkdirSync(tmp('node-test-realpath-d2'), 0o700);
try {
[
[entry, '../' + common.tmpDirName + '/node-test-realpath-d1/foo'],
[entry, common.tmpDir + '/node-test-realpath-d1/foo'],
[tmp('node-test-realpath-d1'),
'../' + common.tmpDirName + '/node-test-realpath-d2'],
common.tmpDir + '/node-test-realpath-d2'],
[tmp('node-test-realpath-d2/foo'), '../node-test-realpath-f2'],
[tmp('node-test-realpath-f2'), fixturesAbsDir +
'/nested-index/one/realpath-c'],
'/nested-index/one/realpath-c'],
[fixturesAbsDir + '/nested-index/one/realpath-c', fixturesAbsDir +
'/nested-index/two/realpath-c'],
'/nested-index/two/realpath-c'],
[fixturesAbsDir + '/nested-index/two/realpath-c',
'../../../' + common.tmpDirName + '/cycles/root.js']
common.tmpDir + '/cycles/root.js']
].forEach(function(t) {
try { fs.unlinkSync(t[0]); } catch (e) {}
fs.symlinkSync(t[1], t[0]);
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-fs-symlink-dir-junction-relative.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var expected_tests = 2;
var linkPath1 = path.join(common.tmpDir, 'junction1');
var linkPath2 = path.join(common.tmpDir, 'junction2');
var linkTarget = path.join(common.fixturesDir);
var linkData = '../fixtures';
var linkData = path.join(common.fixturesDir);

common.refreshTmpDir();

Expand Down Expand Up @@ -42,4 +42,3 @@ function verifyLink(linkPath) {
process.on('exit', function() {
assert.equal(completed, expected_tests);
});

0 comments on commit 5110e4d

Please sign in to comment.