(realpath, realpathSync, callback)
| 272 | } |
| 273 | |
| 274 | function test_relative_input_cwd(realpath, realpathSync, callback) { |
| 275 | console.log('test_relative_input_cwd'); |
| 276 | if (skipSymlinks) { |
| 277 | common.printSkipMessage('symlink test (no privs)'); |
| 278 | return callback(); |
| 279 | } |
| 280 | |
| 281 | // We need to calculate the relative path to the tmp dir from cwd |
| 282 | const entrydir = process.cwd(); |
| 283 | const entry = path.relative(entrydir, |
| 284 | path.join(`${tmpDir}/cycles/realpath-3a`)); |
| 285 | const expected = `${tmpDir}/cycles/root.js`; |
| 286 | [ |
| 287 | [entry, '../cycles/realpath-3b'], |
| 288 | [`${tmpDir}/cycles/realpath-3b`, '../cycles/realpath-3c'], |
| 289 | [`${tmpDir}/cycles/realpath-3c`, 'root.js'], |
| 290 | ].forEach(function(t) { |
| 291 | const fn = t[0]; |
| 292 | console.error('fn=%j', fn); |
| 293 | try { fs.unlinkSync(fn); } catch { |
| 294 | // Continue regardless of error. |
| 295 | } |
| 296 | const b = path.basename(t[1]); |
| 297 | const type = (b === 'root.js' ? 'file' : 'dir'); |
| 298 | console.log('fs.symlinkSync(%j, %j, %j)', t[1], fn, type); |
| 299 | fs.symlinkSync(t[1], fn, 'file'); |
| 300 | unlink.push(fn); |
| 301 | }); |
| 302 | |
| 303 | const origcwd = process.cwd(); |
| 304 | process.chdir(entrydir); |
| 305 | assertEqualPath(realpathSync(entry), path.resolve(expected)); |
| 306 | asynctest(realpath, [entry], callback, function(err, result) { |
| 307 | process.chdir(origcwd); |
| 308 | assertEqualPath(result, path.resolve(expected)); |
| 309 | return true; |
| 310 | }); |
| 311 | } |
| 312 | |
| 313 | function test_deep_symlink_mix(realpath, realpathSync, callback) { |
| 314 | console.log('test_deep_symlink_mix'); |
nothing calls this directly
no test coverage detected
searching dependent graphs…