From 2e1ed890b85d4ecf1a6332cf2e0c121d5640b496 Mon Sep 17 00:00:00 2001 From: Vincent LE GOFF Date: Mon, 18 Mar 2019 16:08:01 +0100 Subject: Documentation clean up (denoland/deno_std#288) Original: https://github.com/denoland/deno_std/commit/b699fa67befaef4423f365e55eff0fec2e14def8 --- testing/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'testing') diff --git a/testing/README.md b/testing/README.md index 05cb8b92e..3d49c5a76 100644 --- a/testing/README.md +++ b/testing/README.md @@ -9,7 +9,7 @@ The module exports a `test` function which is the test harness in Deno. It accepts either a function (including async functions) or an object which contains a `name` property and a `fn` property. When running tests and outputting the results, the name of the past function is used, or if the -object is passed, the `name` property is used to identify the test. +object is passed, the `name` property is used to identify the test. If the assertion is false an `AssertionError` will be thrown. Asserts are exposed in `testing/asserts.ts` module. @@ -18,8 +18,13 @@ Asserts are exposed in `testing/asserts.ts` module. - `assert()` - Expects a boolean value, throws if the value is `false`. - `assertEquals()` - Uses the `equal` comparison and throws if the `actual` and `expected` are not equal. +- `assertNotEquals()` - Uses the `equal` comparison and throws if the `actual` and + `expected` are equal. - `assertStrictEq()` - Compares `actual` and `expected` strictly, therefore for non-primitives the values must reference the same instance. +- `assertStrContains()` - Make an assertion that `actual` contains `expected`. +- `assertMatch()` - Make an assertion that `actual` match RegExp `expected`. +- `assertArrayContains()` - Make an assertion that `actual` array contains the `expected` values. - `assertThrows()` - Expects the passed `fn` to throw. If `fn` does not throw, this function does. Also compares any errors thrown to an optional expected `Error` class and checks that the error `.message` includes an optional @@ -29,6 +34,8 @@ Asserts are exposed in `testing/asserts.ts` module. function will throw asynchronously. Also compares any errors thrown to an optional expected `Error` class and checks that the error `.message` includes an optional string. +- `unimplemented()` - Use this to stub out methods that will throw when invoked +- `unreachable()` - Used to assert unreachable code `runTests()` executes the declared tests. -- cgit v1.2.3