Skip to content

Commit eca9e72

Browse files
clarencedMylesBorins
authored andcommitted
test: add regex in test_cyclic_link_protection
PR-URL: #11622 Backport-PR-URL: #13785 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 6020e72 commit eca9e72

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎test/parallel/test-fs-realpath.js‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,25 @@ function test_cyclic_link_protection(callback) {
190190
common.skip('symlink test (no privs)');
191191
returnrunNextTest();
192192
}
193-
constentry=common.tmpDir+'/cycles/realpath-3a';
193+
constentry=path.join(common.tmpDir,'/cycles/realpath-3a');
194194
[
195195
[entry,'../cycles/realpath-3b'],
196-
[common.tmpDir+'/cycles/realpath-3b','../cycles/realpath-3c'],
197-
[common.tmpDir+'/cycles/realpath-3c','../cycles/realpath-3a']
196+
[path.join(common.tmpDir,'/cycles/realpath-3b'),'../cycles/realpath-3c'],
197+
[path.join(common.tmpDir,'/cycles/realpath-3c'),'../cycles/realpath-3a']
198198
].forEach(function(t){
199199
try{fs.unlinkSync(t[0]);}catch(e){}
200200
fs.symlinkSync(t[1],t[0],'dir');
201201
unlink.push(t[0]);
202202
});
203-
assert.throws(function(){fs.realpathSync(entry);});
204-
asynctest(fs.realpath,[entry],callback,function(err,result){
205-
assert.ok(err&&true);
206-
returntrue;
207-
});
203+
assert.throws(()=>{
204+
fs.realpathSync(entry);
205+
},/^Error:ELOOP:toomanysymboliclinksencountered,stat/);
206+
asynctest(
207+
fs.realpath,[entry],callback,common.mustCall(function(err,result){
208+
assert.strictEqual(err.path,entry);
209+
assert.strictEqual(result,undefined);
210+
returntrue;
211+
}));
208212
}
209213

210214
functiontest_cyclic_link_overprotection(callback){

0 commit comments

Comments
 (0)