diff options
author | João Souto <joao.jpgs@hotmail.com> | 2020-02-25 20:36:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 15:36:35 -0500 |
commit | e53064c4f22efeb8a4eda2712e15c77d2699a686 (patch) | |
tree | b82b6b15f5cd664e177fd66a468161717133ab59 /cli/tests/permission_test.ts | |
parent | be787d09d537d6c1a6846168613dd0defe069448 (diff) |
Port permission_prompt_tests to Rust (#4129)
Diffstat (limited to 'cli/tests/permission_test.ts')
-rw-r--r-- | cli/tests/permission_test.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/tests/permission_test.ts b/cli/tests/permission_test.ts new file mode 100644 index 000000000..763e429b6 --- /dev/null +++ b/cli/tests/permission_test.ts @@ -0,0 +1,34 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const { args, listen, env, exit, makeTempDirSync, readFileSync, run } = Deno; + +const name = args[0]; +const test: { [key: string]: Function } = { + async readRequired(): Promise<void> { + readFileSync("README.md"); + }, + writeRequired(): void { + makeTempDirSync(); + }, + envRequired(): void { + env().home; + }, + netRequired(): void { + listen({ transport: "tcp", port: 4541 }); + }, + runRequired(): void { + run({ + args: [ + "python", + "-c", + "import sys; sys.stdout.write('hello'); sys.stdout.flush()" + ] + }); + } +}; + +if (!test[name]) { + console.log("Unknown test:", name); + exit(1); +} + +test[name](); |