mirror of
https://github.com/denoland/deno.git
synced 2024-12-14 03:23:17 -05:00
4192978c3a
This upgrade includes a warning for the deprecated "Deno.run()" API. --------- Co-authored-by: David Sherret <dsherret@gmail.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { complex } from "./complex.ts";
|
|
|
|
Deno.test("complex", function () {
|
|
complex("foo", "bar", "baz");
|
|
});
|
|
|
|
Deno.test("sub process with stdin", async () => {
|
|
// ensure launching deno run with stdin doesn't affect coverage
|
|
const code = "console.log('5')";
|
|
// deno-lint-ignore no-deprecated-deno-api
|
|
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')";
|
|
// deno-lint-ignore no-deprecated-deno-api
|
|
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");
|
|
}
|
|
});
|