diff options
author | uki00a <uki00a@gmail.com> | 2020-02-24 22:31:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 08:31:40 -0500 |
commit | fe9ac35a650dfeea9168fc1cbbbf323b5689fc3b (patch) | |
tree | 56008d06659dbc0cc167eb0380006dbc5b3d48f4 /std/examples/tests/welcome_test.ts | |
parent | 162d66d23fe984d7ac0396faacb8800f19a719fd (diff) |
fix(std/examples): add tests for examples (#4094)
Diffstat (limited to 'std/examples/tests/welcome_test.ts')
-rw-r--r-- | std/examples/tests/welcome_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/std/examples/tests/welcome_test.ts b/std/examples/tests/welcome_test.ts new file mode 100644 index 000000000..76209cfad --- /dev/null +++ b/std/examples/tests/welcome_test.ts @@ -0,0 +1,19 @@ +// 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({ + args: [Deno.execPath(), "welcome.ts"], + cwd: "examples", + stdout: "piped" + }); + try { + const output = await Deno.readAll(process.stdout!); + const actual = decoder.decode(output).trim(); + const expected = "Welcome to Deno 🦕"; + assertStrictEq(actual, expected); + } finally { + process.close(); + } +}); |