2020-02-25 15:36:35 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2020-06-12 15:23:38 -04:00
|
|
|
const name = Deno.args[0];
|
2020-11-03 10:19:29 -05:00
|
|
|
// deno-lint-ignore no-explicit-any
|
2020-08-24 19:43:54 -04:00
|
|
|
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
|
2021-08-05 07:08:58 -04:00
|
|
|
readRequired() {
|
2021-08-11 10:20:47 -04:00
|
|
|
Deno.readFileSync("hello.txt");
|
2020-03-20 09:38:34 -04:00
|
|
|
return Promise.resolve();
|
2020-02-25 15:36:35 -05:00
|
|
|
},
|
2021-08-05 07:08:58 -04:00
|
|
|
writeRequired() {
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.makeTempDirSync();
|
2020-02-25 15:36:35 -05:00
|
|
|
},
|
2021-08-05 07:08:58 -04:00
|
|
|
envRequired() {
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.env.get("home");
|
2020-02-25 15:36:35 -05:00
|
|
|
},
|
2021-08-05 07:08:58 -04:00
|
|
|
netRequired() {
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.listen({ transport: "tcp", port: 4541 });
|
2020-02-25 15:36:35 -05:00
|
|
|
},
|
2022-05-18 16:00:11 -04:00
|
|
|
async runRequired() {
|
|
|
|
await Deno.spawn(Deno.build.os === "windows" ? "cmd.exe" : "printf", {
|
|
|
|
args: Deno.build.os === "windows" ? ["/c", "echo hello"] : ["hello"],
|
2020-02-25 15:36:35 -05:00
|
|
|
});
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2020-02-25 15:36:35 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!test[name]) {
|
|
|
|
console.log("Unknown test:", name);
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.exit(1);
|
2020-02-25 15:36:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
test[name]();
|