Browse Source

test-fs-realpath: Don't ceate things in /tmp; use tmpDir

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
105501c195
  1. 20
      test/simple/test-fs-realpath.js

20
test/simple/test-fs-realpath.js

@ -5,6 +5,10 @@ var path = require('path');
var exec = require('child_process').exec;
var async_completed = 0, async_expected = 0, unlink = [];
function tmp (p) {
return path.join(common.tmpDir, p);
}
function asynctest(testBlock, args, callback, assertBlock) {
async_expected++;
testBlock.apply(testBlock, args.concat(function(err){
@ -200,16 +204,16 @@ function test_deep_symlink_mix(callback) {
/node/test/fixtures/nested-index/two/realpath-c -> ../../cycles/root.js
/node/test/fixtures/cycles/root.js (hard)
*/
var entry = '/tmp/node-test-realpath-f1';
try {fs.unlinkSync('/tmp/node-test-realpath-d2/foo');}catch(e){}
try {fs.rmdirSync('/tmp/node-test-realpath-d2');}catch(e){}
fs.mkdirSync('/tmp/node-test-realpath-d2', 0700);
var entry = tmp('node-test-realpath-f1');
try { fs.unlinkSync(tmp('node-test-realpath-d2/foo')); } catch (e) {}
try { fs.rmdirSync(tmp('node-test-realpath-d2')); } catch(e) {}
fs.mkdirSync(tmp('node-test-realpath-d2'), 0700);
try {
[
[entry, '../tmp/node-test-realpath-d1/foo'],
['/tmp/node-test-realpath-d1', '../tmp/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'],
[tmp('node-test-realpath-d1'), '../tmp/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'],
[fixturesAbsDir+'/nested-index/one/realpath-c', fixturesAbsDir+'/nested-index/two/realpath-c'],
[fixturesAbsDir+'/nested-index/two/realpath-c', '../../cycles/root.js'],
].forEach(function(t) {
@ -219,7 +223,7 @@ function test_deep_symlink_mix(callback) {
unlink.push(t[0]);
});
} finally {
unlink.push('/tmp/node-test-realpath-d2');
unlink.push(tmp('node-test-realpath-d2'));
}
var expected = fixturesAbsDir+'/cycles/root.js';
assert.equal(fs.realpathSync(entry), expected);

Loading…
Cancel
Save