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