diff options
author | Clarence Dimitri CHARLES <clarence.dimitri.charles@gmail.com> | 2017-02-19 20:30:15 +0300 |
---|---|---|
committer | Italo A. Casas <me@italoacasas.com> | 2017-03-13 18:19:41 +0300 |
commit | 4477e152173c780a728e61427aab8220f0abf918 (patch) | |
tree | 185c4f20982dcb028d3f01521b189010cf8c8b36 /test | |
parent | 3d55cf06b10444a13343a698cf6293ce00c906b3 (diff) |
test: add regex in test_cyclic_link_protection
PR-URL: https://github.com/nodejs/node/pull/11622
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-fs-realpath.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 331cec5ee8c..96a6deae8af 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -191,21 +191,25 @@ function test_cyclic_link_protection(callback) { common.skip('symlink test (no privs)'); return runNextTest(); } - const entry = common.tmpDir + '/cycles/realpath-3a'; + const entry = path.join(common.tmpDir, '/cycles/realpath-3a'); [ [entry, '../cycles/realpath-3b'], - [common.tmpDir + '/cycles/realpath-3b', '../cycles/realpath-3c'], - [common.tmpDir + '/cycles/realpath-3c', '../cycles/realpath-3a'] + [path.join(common.tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'], + [path.join(common.tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a'] ].forEach(function(t) { try { fs.unlinkSync(t[0]); } catch (e) {} fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }); - asynctest(fs.realpath, [entry], callback, function(err, result) { - assert.ok(err && true); - return true; - }); + assert.throws(() => { + fs.realpathSync(entry); + }, common.expectsError({ code: 'ELOOP', type: Error })); + asynctest( + fs.realpath, [entry], callback, common.mustCall(function(err, result) { + assert.strictEqual(err.path, entry); + assert.strictEqual(result, undefined); + return true; + })); } function test_cyclic_link_overprotection(callback) { |