2021-02-24 09:27:51 -05:00
|
|
|
import { complex } from "./complex.ts";
|
2021-01-29 14:45:22 -05:00
|
|
|
|
|
|
|
Deno.test("complex", function () {
|
|
|
|
complex("foo", "bar", "baz");
|
|
|
|
});
|
2022-08-12 15:21:17 -04:00
|
|
|
|
|
|
|
Deno.test("sub process with stdin", async () => {
|
|
|
|
// ensure launching deno run with stdin doesn't affect coverage
|
|
|
|
const code = "console.log('5')";
|
|
|
|
const p = await Deno.run({
|
|
|
|
cmd: [Deno.execPath(), "run", "-"],
|
|
|
|
stdin: "piped",
|
|
|
|
stdout: "piped",
|
|
|
|
});
|
|
|
|
const encoder = new TextEncoder();
|
|
|
|
await p.stdin.write(encoder.encode(code));
|
|
|
|
await p.stdin.close();
|
|
|
|
const output = new TextDecoder().decode(await p.output());
|
|
|
|
p.close();
|
|
|
|
if (output.trim() !== "5") {
|
|
|
|
throw new Error("Failed");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("sub process with deno eval", async () => {
|
|
|
|
// ensure launching deno eval doesn't affect coverage
|
|
|
|
const code = "console.log('5')";
|
|
|
|
const p = await Deno.run({
|
|
|
|
cmd: [Deno.execPath(), "eval", code],
|
|
|
|
stdout: "piped",
|
|
|
|
});
|
|
|
|
const output = new TextDecoder().decode(await p.output());
|
|
|
|
p.close();
|
|
|
|
if (output.trim() !== "5") {
|
|
|
|
throw new Error("Failed");
|
|
|
|
}
|
|
|
|
});
|