mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -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 } },
|
{ perms: { write: true, read: true } },
|
||||||
function readLinkSyncSuccess(): void {
|
function readLinkSyncSuccess(): void {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir + "/target";
|
const target =
|
||||||
const symlink = testDir + "/symln";
|
testDir + (Deno.build.os == "windows" ? "\\target" : "/target");
|
||||||
|
const symlink =
|
||||||
|
testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink");
|
||||||
Deno.mkdirSync(target);
|
Deno.mkdirSync(target);
|
||||||
// TODO Add test for Windows once symlink is implemented for Windows.
|
Deno.symlinkSync(target, symlink);
|
||||||
// See https://github.com/denoland/deno/issues/815.
|
const targetPath = Deno.readLinkSync(symlink);
|
||||||
if (Deno.build.os !== "windows") {
|
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 } },
|
{ perms: { write: true, read: true } },
|
||||||
async function readLinkSuccess(): Promise<void> {
|
async function readLinkSuccess(): Promise<void> {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir + "/target";
|
const target =
|
||||||
const symlink = testDir + "/symln";
|
testDir + (Deno.build.os == "windows" ? "\\target" : "/target");
|
||||||
|
const symlink =
|
||||||
|
testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink");
|
||||||
Deno.mkdirSync(target);
|
Deno.mkdirSync(target);
|
||||||
// TODO Add test for Windows once symlink is implemented for Windows.
|
Deno.symlinkSync(target, symlink);
|
||||||
// See https://github.com/denoland/deno/issues/815.
|
const targetPath = await Deno.readLink(symlink);
|
||||||
if (Deno.build.os !== "windows") {
|
assertEquals(targetPath, target);
|
||||||
Deno.symlinkSync(target, symlink);
|
|
||||||
const targetPath = await Deno.readLink(symlink);
|
|
||||||
assertEquals(targetPath, target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue