diff options
Diffstat (limited to 'std/fs/expand_glob_test.ts')
-rw-r--r-- | std/fs/expand_glob_test.ts | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/std/fs/expand_glob_test.ts b/std/fs/expand_glob_test.ts index 12b0b3d1a..718c8183f 100644 --- a/std/fs/expand_glob_test.ts +++ b/std/fs/expand_glob_test.ts @@ -1,6 +1,7 @@ -const { cwd } = Deno; +const { cwd, execPath, run } = Deno; +import { decode } from "../strings/mod.ts"; import { test, runIfMain } from "../testing/mod.ts"; -import { assert, assertEquals } from "../testing/asserts.ts"; +import { assert, assertEquals, assertStrContains } from "../testing/asserts.ts"; import { isWindows, join, @@ -117,4 +118,20 @@ test(async function expandGlobIncludeDirs(): Promise<void> { assertEquals(await expandGlobArray("subdir", options), []); }); +test(async function expandGlobPermError(): Promise<void> { + const exampleUrl = new URL("testdata/expand_wildcard.js", import.meta.url); + const p = run({ + args: [execPath(), exampleUrl.toString()], + stdin: "null", + stdout: "piped", + stderr: "piped" + }); + assertEquals(await p.status(), { code: 1, success: false }); + assertEquals(decode(await p.output()), ""); + assertStrContains( + decode(await p.stderrOutput()), + "Uncaught PermissionDenied" + ); +}); + runIfMain(import.meta); |