From 4dd52719dee4281228c618dd13eae49ea7d04ff7 Mon Sep 17 00:00:00 2001 From: Masashi Hirano Date: Fri, 4 Jan 2019 04:16:15 +0900 Subject: [PATCH] Add testing/README.md (denoland/deno_std#75) Original: https://github.com/denoland/deno_std/commit/9552f28daf5e9bc77e0ace4032c93e538ef1f9f5 --- testing/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 testing/README.md diff --git a/testing/README.md b/testing/README.md new file mode 100644 index 0000000000..919b1279b8 --- /dev/null +++ b/testing/README.md @@ -0,0 +1,31 @@ +# Testing + +## Usage + +```ts +import { test, assert, equal, assertEqual } from 'https://deno.land/x/testing/testing.ts'; + +test({ + name: 'testing example', + fn() { + assert(equal("world", "world")); + assert(!equal("hello", "world")); + assert(equal({ hello: "world" }, { hello: "world" })); + assert(!equal({ world: "hello" }, { hello: "world" })); + assertEqual("world", "world"); + assertEqual({hello: "world"}, {hello: "world"}); + }, +}); +``` + +Short syntax (named function instead of object): +```ts +test(function example() { + assert(equal("world", "world")); + assert(!equal("hello", "world")); + assert(equal({ hello: "world" }, { hello: "world" })); + assert(!equal({ world: "hello" }, { hello: "world" })); + assertEqual("world", "world"); + assertEqual({hello: "world"}, {hello: "world"}); +}); +``` \ No newline at end of file