mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
Fix readLinkSync and readLink tests on Windows (#6463)
This commit is contained in:
parent
16038b8f82
commit
a455a0babf
1 changed files with 14 additions and 18 deletions
|
@ -10,16 +10,14 @@ unitTest(
|
|||
{ perms: { write: true, read: true } },
|
||||
function readLinkSyncSuccess(): void {
|
||||
const testDir = Deno.makeTempDirSync();
|
||||
const target = testDir + "/target";
|
||||
const symlink = testDir + "/symln";
|
||||
const target =
|
||||
testDir + (Deno.build.os == "windows" ? "\\target" : "/target");
|
||||
const symlink =
|
||||
testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink");
|
||||
Deno.mkdirSync(target);
|
||||
// TODO Add test for Windows once symlink is implemented for Windows.
|
||||
// See https://github.com/denoland/deno/issues/815.
|
||||
if (Deno.build.os !== "windows") {
|
||||
Deno.symlinkSync(target, symlink);
|
||||
const targetPath = Deno.readLinkSync(symlink);
|
||||
assertEquals(targetPath, target);
|
||||
}
|
||||
Deno.symlinkSync(target, symlink);
|
||||
const targetPath = Deno.readLinkSync(symlink);
|
||||
assertEquals(targetPath, target);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -39,16 +37,14 @@ unitTest(
|
|||
{ perms: { write: true, read: true } },
|
||||
async function readLinkSuccess(): Promise<void> {
|
||||
const testDir = Deno.makeTempDirSync();
|
||||
const target = testDir + "/target";
|
||||
const symlink = testDir + "/symln";
|
||||
const target =
|
||||
testDir + (Deno.build.os == "windows" ? "\\target" : "/target");
|
||||
const symlink =
|
||||
testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink");
|
||||
Deno.mkdirSync(target);
|
||||
// TODO Add test for Windows once symlink is implemented for Windows.
|
||||
// See https://github.com/denoland/deno/issues/815.
|
||||
if (Deno.build.os !== "windows") {
|
||||
Deno.symlinkSync(target, symlink);
|
||||
const targetPath = await Deno.readLink(symlink);
|
||||
assertEquals(targetPath, target);
|
||||
}
|
||||
Deno.symlinkSync(target, symlink);
|
||||
const targetPath = await Deno.readLink(symlink);
|
||||
assertEquals(targetPath, target);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue