2020-02-25 20:36:35 +00:00
|
|
|
// 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 14:38:34 +01:00
|
|
|
readRequired(): Promise<void> {
|
2020-02-25 20:36:35 +00:00
|
|
|
readFileSync("README.md");
|
2020-03-20 14:38:34 +01:00
|
|
|
return Promise.resolve();
|
2020-02-25 20:36:35 +00:00
|
|
|
},
|
|
|
|
writeRequired(): void {
|
|
|
|
makeTempDirSync();
|
|
|
|
},
|
|
|
|
envRequired(): void {
|
2020-04-29 20:48:19 +02:00
|
|
|
env.get("home");
|
2020-02-25 20:36:35 +00:00
|
|
|
},
|
|
|
|
netRequired(): void {
|
|
|
|
listen({ transport: "tcp", port: 4541 });
|
|
|
|
},
|
|
|
|
runRequired(): void {
|
|
|
|
run({
|
2020-03-22 03:14:18 +05:30
|
|
|
cmd: [
|
2020-02-25 20:36:35 +00:00
|
|
|
"python",
|
|
|
|
"-c",
|
2020-03-29 04:03:49 +11:00
|
|
|
"import sys; sys.stdout.write('hello'); sys.stdout.flush()",
|
|
|
|
],
|
2020-02-25 20:36:35 +00:00
|
|
|
});
|
2020-03-29 04:03:49 +11:00
|
|
|
},
|
2020-02-25 20:36:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!test[name]) {
|
|
|
|
console.log("Unknown test:", name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
test[name]();
|