blob: ac42b7d69e4a160ceed3069fd699df5e338b0f3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
// deno-lint-ignore no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
readRequired(): Promise<void> {
Deno.readFileSync("README.md");
return Promise.resolve();
},
writeRequired(): void {
Deno.makeTempDirSync();
},
envRequired(): void {
Deno.env.get("home");
},
netRequired(): void {
Deno.listen({ transport: "tcp", port: 4541 });
},
runRequired(): void {
const p = Deno.run({
cmd: Deno.build.os === "windows"
? ["cmd.exe", "/c", "echo hello"]
: ["printf", "hello"],
});
p.close();
},
};
if (!test[name]) {
console.log("Unknown test:", name);
Deno.exit(1);
}
test[name]();
|