MCPcopy Create free account
hub / github.com/nodejs/node / test_deep_relative_dir_symlink

Function test_deep_relative_dir_symlink

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

Source from the content-addressed store, hash-verified

188}
189
190function test_deep_relative_dir_symlink(realpath, realpathSync, callback) {
191 console.log('test_deep_relative_dir_symlink');
192 if (skipSymlinks) {
193 common.printSkipMessage('symlink test (no privs)');
194 return callback();
195 }
196 const expected = fixtures.path('cycles', 'folder');
197 const path1b = path.join(targetsAbsDir, 'nested-index', 'one');
198 const linkPath1b = path.join(path1b, 'symlink1-dir');
199 const linkData1b = path.relative(path1b, expected);
200 try { fs.unlinkSync(linkPath1b); } catch {
201 // Continue regardless of error.
202 }
203 fs.symlinkSync(linkData1b, linkPath1b, 'dir');
204
205 const linkData2b = '../one/symlink1-dir';
206 const entry = path.join(targetsAbsDir,
207 'nested-index', 'two', 'symlink12-dir');
208 try { fs.unlinkSync(entry); } catch {
209 // Continue regardless of error.
210 }
211 fs.symlinkSync(linkData2b, entry, 'dir');
212 unlink.push(linkPath1b);
213 unlink.push(entry);
214
215 assertEqualPath(realpathSync(entry), path.resolve(expected));
216
217 asynctest(realpath, [entry], callback, function(err, result) {
218 assertEqualPath(result, path.resolve(expected));
219 });
220}
221
222function test_cyclic_link_protection(realpath, realpathSync, callback) {
223 console.log('test_cyclic_link_protection');

Callers

nothing calls this directly

Calls 10

asynctestFunction · 0.85
callbackFunction · 0.70
realpathSyncFunction · 0.50
logMethod · 0.45
pathMethod · 0.45
joinMethod · 0.45
unlinkSyncMethod · 0.45
symlinkSyncMethod · 0.45
pushMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected