diff options
Diffstat (limited to 'cli/tests/testdata/permission_test.ts')
| -rw-r--r-- | cli/tests/testdata/permission_test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/testdata/permission_test.ts b/cli/tests/testdata/permission_test.ts new file mode 100644 index 000000000..a3a38f2a0 --- /dev/null +++ b/cli/tests/testdata/permission_test.ts @@ -0,0 +1,33 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const name = Deno.args[0]; +// deno-lint-ignore no-explicit-any +const test: { [key: string]: (...args: any[]) => void | Promise<void> } = { + readRequired() { + Deno.readFileSync("hello.txt"); + return Promise.resolve(); + }, + writeRequired() { + Deno.makeTempDirSync(); + }, + envRequired() { + Deno.env.get("home"); + }, + netRequired() { + Deno.listen({ transport: "tcp", port: 4541 }); + }, + runRequired() { + const p = Deno.run({ + cmd: Deno.build.os === "windows" + ? ["cmd.exe", "/c", "echo hello"] + : ["printf", "hello"], + }); + p.close(); + }, +}; + +if (!test[name]) { + console.log("Unknown test:", name); + Deno.exit(1); +} + +test[name](); |
