summaryrefslogtreecommitdiff
path: root/testing/mod.ts
diff options
context:
space:
mode:
authorJames Garbutt <43081j@users.noreply.github.com>2019-01-26 11:51:19 +0000
committerRyan Dahl <ry@tinyclouds.org>2019-01-26 06:51:19 -0500
commitbe65b2b0f69c32d0ac357976665c702adca02e37 (patch)
tree623d6ef333b0261075ac93f677b59911aeff2fff /testing/mod.ts
parent6a0e32dc35dd27807f4b95556ddb8c1fe26fae89 (diff)
testing: add fail() (denoland/deno_std#123)
Original: https://github.com/denoland/deno_std/commit/c1c18c9469663ec54177d2b25f9778227b7dc813
Diffstat (limited to 'testing/mod.ts')
-rw-r--r--testing/mod.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/testing/mod.ts b/testing/mod.ts
index 762d37c48..06089a80a 100644
--- a/testing/mod.ts
+++ b/testing/mod.ts
@@ -74,6 +74,13 @@ const assertions = {
}
},
+ /**
+ * Forcefully throws a failed assertion
+ */
+ fail(msg?: string): void {
+ assert(false, `Failed assertion${msg ? `: ${msg}` : "."}`);
+ },
+
/** Executes a function, expecting it to throw. If it does not, then it
* throws. An error class and a string that should be included in the
* error message can also be asserted.