2019-01-12 11:29:45 -05:00
|
|
|
import { args, listen, env, exit, makeTempDirSync, run } from "deno";
|
2018-10-27 09:11:39 -04:00
|
|
|
|
|
|
|
const name = args[1];
|
|
|
|
const test = {
|
|
|
|
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();
|
2018-10-27 09:11:39 -04:00
|
|
|
}
|
|
|
|
}[name];
|
|
|
|
|
|
|
|
if (!test) {
|
|
|
|
console.log("Unknown test:", name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
test();
|