summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/symlink_test.ts43
1 files changed, 42 insertions, 1 deletions
diff --git a/cli/tests/unit/symlink_test.ts b/cli/tests/unit/symlink_test.ts
index 19e83660b..eef993d17 100644
--- a/cli/tests/unit/symlink_test.ts
+++ b/cli/tests/unit/symlink_test.ts
@@ -1,5 +1,10 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import { assert, assertThrows, unitTest } from "./test_util.ts";
+import {
+ assert,
+ assertThrows,
+ pathToAbsoluteFileUrl,
+ unitTest,
+} from "./test_util.ts";
unitTest(
{ perms: { read: true, write: true } },
@@ -16,6 +21,24 @@ unitTest(
},
);
+unitTest(
+ { perms: { read: true, write: true } },
+ function symlinkSyncURL(): void {
+ const testDir = Deno.makeTempDirSync();
+ const oldname = testDir + "/oldname";
+ const newname = testDir + "/newname";
+ Deno.mkdirSync(oldname);
+ Deno.symlinkSync(
+ pathToAbsoluteFileUrl(oldname),
+ pathToAbsoluteFileUrl(newname),
+ );
+ const newNameInfoLStat = Deno.lstatSync(newname);
+ const newNameInfoStat = Deno.statSync(newname);
+ assert(newNameInfoLStat.isSymlink);
+ assert(newNameInfoStat.isDirectory);
+ },
+);
+
unitTest(function symlinkSyncPerm(): void {
assertThrows(() => {
Deno.symlinkSync("oldbaddir", "newbaddir");
@@ -36,3 +59,21 @@ unitTest(
assert(newNameInfoStat.isDirectory, "NOT DIRECTORY");
},
);
+
+unitTest(
+ { perms: { read: true, write: true } },
+ async function symlinkURL(): Promise<void> {
+ const testDir = Deno.makeTempDirSync();
+ const oldname = testDir + "/oldname";
+ const newname = testDir + "/newname";
+ Deno.mkdirSync(oldname);
+ await Deno.symlink(
+ pathToAbsoluteFileUrl(oldname),
+ pathToAbsoluteFileUrl(newname),
+ );
+ const newNameInfoLStat = Deno.lstatSync(newname);
+ const newNameInfoStat = Deno.statSync(newname);
+ assert(newNameInfoLStat.isSymlink, "NOT SYMLINK");
+ assert(newNameInfoStat.isDirectory, "NOT DIRECTORY");
+ },
+);