0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -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,17 +10,15 @@ 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);
}
}
);
unitTest({ perms: { read: false } }, function readLinkSyncPerm(): void {
@ -39,17 +37,15 @@ 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);
}
}
);
unitTest({ perms: { read: false } }, async function readLinkPerm(): Promise<