2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-02-26 00:35:50 -05:00
|
|
|
const { run } = Deno;
|
2019-03-06 19:42:24 -05:00
|
|
|
import { assertEquals } from "../testing/asserts.ts";
|
2018-12-19 13:50:48 -05:00
|
|
|
|
|
|
|
/** Example of how to do basic tests */
|
2020-02-11 11:24:27 -05:00
|
|
|
Deno.test(function t1(): void {
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals("hello", "hello");
|
2018-12-19 13:50:48 -05:00
|
|
|
});
|
|
|
|
|
2020-02-11 11:24:27 -05:00
|
|
|
Deno.test(function t2(): void {
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals("world", "world");
|
2018-12-19 13:50:48 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
/** A more complicated test that runs a subprocess. */
|
2020-02-11 11:24:27 -05:00
|
|
|
Deno.test(async function catSmoke(): Promise<void> {
|
2018-12-19 13:50:48 -05:00
|
|
|
const p = run({
|
2020-03-21 17:44:18 -04:00
|
|
|
cmd: [
|
2019-08-13 20:03:29 -04:00
|
|
|
Deno.execPath(),
|
2019-07-29 04:46:21 -04:00
|
|
|
"run",
|
|
|
|
"--allow-read",
|
|
|
|
"examples/cat.ts",
|
2020-03-28 13:03:49 -04:00
|
|
|
"README.md",
|
2019-07-29 04:46:21 -04:00
|
|
|
],
|
2020-03-18 19:25:55 -04:00
|
|
|
stdout: "null",
|
2020-03-28 13:03:49 -04:00
|
|
|
stderr: "null",
|
2018-12-19 13:50:48 -05:00
|
|
|
});
|
|
|
|
const s = await p.status();
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(s.code, 0);
|
2020-03-18 19:25:55 -04:00
|
|
|
p.close();
|
2018-12-19 13:50:48 -05:00
|
|
|
});
|