mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
33 lines
757 B
TypeScript
33 lines
757 B
TypeScript
// 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() {
|
|
Deno.readFileSync("README.md");
|
|
return Promise.resolve();
|
|
},
|
|
writeRequired() {
|
|
Deno.makeTempDirSync();
|
|
},
|
|
envRequired() {
|
|
Deno.env.get("home");
|
|
},
|
|
netRequired() {
|
|
Deno.listen({ transport: "tcp", port: 4541 });
|
|
},
|
|
runRequired() {
|
|
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]();
|