1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
denoland-deno/tools/permission_prompt_test.ts

36 lines
693 B
TypeScript
Raw Normal View History

2019-01-21 14:03:30 -05:00
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { args, listen, env, exit, makeTempDirSync, readFile, run } = Deno;
const name = args[1];
const test = {
2019-02-09 05:31:03 -05:00
needsRead: () => {
2019-02-11 12:57:26 -05:00
readFile("package.json");
2019-02-09 05:31:03 -05:00
},
needsWrite: () => {
makeTempDirSync();
},
needsEnv: () => {
env().home;
},
needsNet: () => {
listen("tcp", "127.0.0.1:4540");
2019-01-12 11:29:45 -05:00
},
2019-01-13 12:09:45 -05:00
needsRun: async () => {
const process = run({
args: [
"python",
"-c",
"import sys; sys.stdout.write('hello'); sys.stdout.flush()"
]
});
await process.status();
}
}[name];
if (!test) {
console.log("Unknown test:", name);
exit(1);
}
test();