MCPcopy Index your code
hub / github.com/nodejs/node / test_simple_relative_symlink

Function test_simple_relative_symlink

test/parallel/test-fs-realpath.js:103–126  ·  view source on GitHub ↗
(realpath, realpathSync, callback)

Source from the content-addressed store, hash-verified

101}
102
103function test_simple_relative_symlink(realpath, realpathSync, callback) {
104 console.log('test_simple_relative_symlink');
105 if (skipSymlinks) {
106 common.printSkipMessage('symlink test (no privs)');
107 return callback();
108 }
109 const entry = `${tmpDir}/symlink`;
110 const expected = `${tmpDir}/cycles/root.js`;
111 [
112 [entry, `../${path.basename(tmpDir)}/cycles/root.js`],
113 ].forEach(function(t) {
114 try { fs.unlinkSync(t[0]); } catch {
115 // Continue regardless of error.
116 }
117 console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
118 fs.symlinkSync(t[1], t[0], 'file');
119 unlink.push(t[0]);
120 });
121 const result = realpathSync(entry);
122 assertEqualPath(result, path.resolve(expected));
123 asynctest(realpath, [entry], callback, function(err, result) {
124 assertEqualPath(result, path.resolve(expected));
125 });
126}
127
128function test_simple_absolute_symlink(realpath, realpathSync, callback) {
129 console.log('test_simple_absolute_symlink');

Callers

nothing calls this directly

Calls 9

asynctestFunction · 0.85
callbackFunction · 0.70
forEachMethod · 0.65
realpathSyncFunction · 0.50
logMethod · 0.45
unlinkSyncMethod · 0.45
symlinkSyncMethod · 0.45
pushMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected