0
0
Fork 0
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:
Casper Beyer 2020-06-25 19:27:23 +08:00 committed by GitHub
parent 16038b8f82
commit a455a0babf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
);