From 61273085e40fb4d992eef4b1b5601e3567c80664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 11 Feb 2020 17:24:27 +0100 Subject: refactor: rewrite tests in std/ to use Deno.test (#3930) --- std/examples/test.ts | 7 +++---- std/examples/tests/xeval_test.ts | 9 ++++----- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'std/examples') diff --git a/std/examples/test.ts b/std/examples/test.ts index 26dd989e4..641a2ef74 100644 --- a/std/examples/test.ts +++ b/std/examples/test.ts @@ -1,19 +1,18 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. const { run } = Deno; -import { test } from "../testing/mod.ts"; import { assertEquals } from "../testing/asserts.ts"; /** Example of how to do basic tests */ -test(function t1(): void { +Deno.test(function t1(): void { assertEquals("hello", "hello"); }); -test(function t2(): void { +Deno.test(function t2(): void { assertEquals("world", "world"); }); /** A more complicated test that runs a subprocess. */ -test(async function catSmoke(): Promise { +Deno.test(async function catSmoke(): Promise { const p = run({ args: [ Deno.execPath(), diff --git a/std/examples/tests/xeval_test.ts b/std/examples/tests/xeval_test.ts index 1c4be1f95..bfd66c097 100644 --- a/std/examples/tests/xeval_test.ts +++ b/std/examples/tests/xeval_test.ts @@ -6,16 +6,15 @@ import { assertStrContains, assert } from "../../testing/asserts.ts"; -import { test } from "../../testing/mod.ts"; const { execPath, run } = Deno; -test(async function xevalSuccess(): Promise { +Deno.test(async function xevalSuccess(): Promise { const chunks: string[] = []; await xeval(stringsReader("a\nb\nc"), ($): number => chunks.push($)); assertEquals(chunks, ["a", "b", "c"]); }); -test(async function xevalDelimiter(): Promise { +Deno.test(async function xevalDelimiter(): Promise { const chunks: string[] = []; await xeval(stringsReader("!MADMADAMADAM!"), ($): number => chunks.push($), { delimiter: "MADAM" @@ -26,7 +25,7 @@ test(async function xevalDelimiter(): Promise { // https://github.com/denoland/deno/issues/2861 const xevalPath = "examples/xeval.ts"; -test(async function xevalCliReplvar(): Promise { +Deno.test(async function xevalCliReplvar(): Promise { const p = run({ args: [execPath(), xevalPath, "--", "--replvar=abc", "console.log(abc)"], stdin: "piped", @@ -40,7 +39,7 @@ test(async function xevalCliReplvar(): Promise { assertEquals(decode(await p.output()).trimEnd(), "hello"); }); -test(async function xevalCliSyntaxError(): Promise { +Deno.test(async function xevalCliSyntaxError(): Promise { const p = run({ args: [execPath(), xevalPath, "--", "("], stdin: "null", -- cgit v1.2.3