(realpath, realpathSync, callback)
| 220 | } |
| 221 | |
| 222 | function test_cyclic_link_protection(realpath, realpathSync, callback) { |
| 223 | console.log('test_cyclic_link_protection'); |
| 224 | if (skipSymlinks) { |
| 225 | common.printSkipMessage('symlink test (no privs)'); |
| 226 | return callback(); |
| 227 | } |
| 228 | const entry = path.join(tmpDir, '/cycles/realpath-3a'); |
| 229 | [ |
| 230 | [entry, '../cycles/realpath-3b'], |
| 231 | [path.join(tmpDir, '/cycles/realpath-3b'), '../cycles/realpath-3c'], |
| 232 | [path.join(tmpDir, '/cycles/realpath-3c'), '../cycles/realpath-3a'], |
| 233 | ].forEach(function(t) { |
| 234 | try { fs.unlinkSync(t[0]); } catch { |
| 235 | // Continue regardless of error. |
| 236 | } |
| 237 | fs.symlinkSync(t[1], t[0], 'dir'); |
| 238 | unlink.push(t[0]); |
| 239 | }); |
| 240 | assert.throws(() => { |
| 241 | realpathSync(entry); |
| 242 | }, { code: 'ELOOP', name: 'Error' }); |
| 243 | asynctest( |
| 244 | realpath, [entry], callback, common.mustCall(function(err, result) { |
| 245 | assert.strictEqual(err.path, entry); |
| 246 | assert.strictEqual(result, undefined); |
| 247 | return true; |
| 248 | })); |
| 249 | } |
| 250 | |
| 251 | function test_cyclic_link_overprotection(realpath, realpathSync, callback) { |
| 252 | console.log('test_cyclic_link_overprotection'); |
nothing calls this directly
no test coverage detected
searching dependent graphs…