1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-12 10:37:52 -05:00
denoland-deno/cli/tests/permission_test.ts

36 lines
753 B
TypeScript
Raw Normal View History

// 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 } = {
2020-03-20 09:38:34 -04:00
readRequired(): Promise<void> {
readFileSync("README.md");
2020-03-20 09:38:34 -04:00
return Promise.resolve();
},
writeRequired(): void {
makeTempDirSync();
},
envRequired(): void {
env().home;
},
netRequired(): void {
listen({ transport: "tcp", port: 4541 });
},
runRequired(): void {
run({
cmd: [
"python",
"-c",
"import sys; sys.stdout.write('hello'); sys.stdout.flush()",
],
});
},
};
if (!test[name]) {
console.log("Unknown test:", name);
exit(1);
}
test[name]();