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() {
|
2022-09-19 10:32:21 -04:00
|
|
|
Deno.readFileSync("assets/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() {
|
2022-12-02 08:43:17 -05:00
|
|
|
await new Deno.Command(Deno.build.os === "windows" ? "cmd.exe" : "printf", {
|
2022-05-18 16:00:11 -04:00
|
|
|
args: Deno.build.os === "windows" ? ["/c", "echo hello"] : ["hello"],
|
2022-12-02 08:43:17 -05:00
|
|
|
}).output();
|
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]();
|