2020-02-24 22:31:40 +09:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { assertStrictEq } from "../../testing/asserts.ts";
|
|
|
|
|
|
|
|
Deno.test("[examples/welcome] print a welcome message", async () => {
|
|
|
|
const decoder = new TextDecoder();
|
|
|
|
const process = Deno.run({
|
2020-05-04 13:03:30 +02:00
|
|
|
cmd: [Deno.execPath(), "run", "welcome.ts"],
|
2020-02-24 22:31:40 +09:00
|
|
|
cwd: "examples",
|
2020-03-29 04:03:49 +11:00
|
|
|
stdout: "piped",
|
2020-02-24 22:31:40 +09:00
|
|
|
});
|
|
|
|
try {
|
2020-03-19 00:25:55 +01:00
|
|
|
const output = await process.output();
|
2020-02-24 22:31:40 +09:00
|
|
|
const actual = decoder.decode(output).trim();
|
|
|
|
const expected = "Welcome to Deno 🦕";
|
|
|
|
assertStrictEq(actual, expected);
|
|
|
|
} finally {
|
|
|
|
process.close();
|
|
|
|
}
|
|
|
|
});
|