Fix fs.realpathSync('/')

v0.7.4-release
Ryan Dahl 2010-09-09 18:49:28 -07:00
parent 85fb47c11c
commit 3a9570386a
2 changed files with 12 additions and 1 deletions

View File

@ -519,8 +519,10 @@ function realpathSync (p) {
i = 0;
buf = [''];
}
return buf.join('/');
return buf.join('/') || '/';
}
function realpath (p, cb) {
if (p.charAt(0) !== '/') {
p = path.join(process.cwd(), p);

View File

@ -260,6 +260,15 @@ function runNextTest(err) {
}
runNextTest();
assert.equal('/', fs.realpathSync('/'));
fs.realpath('/', function (err, result) {
assert.equal(null, err);
assert.equal('/', result);
});
process.addListener("exit", function () {
unlink.forEach(function(path){ try {fs.unlinkSync(path);}catch(e){} });
assert.equal(async_completed, async_expected);