diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-05-17 12:31:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 06:31:21 +0200 |
commit | 910935c07125e4710830be0df32a16c3ef278ba6 (patch) | |
tree | 8ebdbdf96c67aec9ecde627987708bfe94f41e72 /cli/tests/unit | |
parent | ac8ea823f5867e35715051176b6a2ff145a3afd1 (diff) |
feat(runtime): support urls for `Deno.realPath` and `Deno.realPathSync` (#10626)
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/real_path_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/tests/unit/real_path_test.ts b/cli/tests/unit/real_path_test.ts index fce28d80b..10e060578 100644 --- a/cli/tests/unit/real_path_test.ts +++ b/cli/tests/unit/real_path_test.ts @@ -1,9 +1,11 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. import { assert, + assertEquals, assertMatch, assertThrows, assertThrowsAsync, + pathToAbsoluteFileUrl, unitTest, } from "./test_util.ts"; @@ -19,6 +21,12 @@ unitTest({ perms: { read: true } }, function realPathSyncSuccess(): void { } }); +unitTest({ perms: { read: true } }, function realPathSyncUrl(): void { + const relative = "cli/tests/fixture.json"; + const url = pathToAbsoluteFileUrl(relative); + assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url)); +}); + unitTest( { perms: { read: true, write: true }, @@ -67,6 +75,15 @@ unitTest({ perms: { read: true } }, async function realPathSuccess(): Promise< }); unitTest( + { perms: { read: true } }, + async function realPathUrl(): Promise<void> { + const relative = "cli/tests/fixture.json"; + const url = pathToAbsoluteFileUrl(relative); + assertEquals(await Deno.realPath(relative), await Deno.realPath(url)); + }, +); + +unitTest( { perms: { read: true, write: true }, }, |