summaryrefslogtreecommitdiff
path: root/std/testing/asserts_test.ts
diff options
context:
space:
mode:
authorChris Knight <cknight1234@gmail.com>2020-03-09 21:46:55 +0000
committerGitHub <noreply@github.com>2020-03-09 17:46:55 -0400
commit2115b38fef654c2d7c5998f40967fcfe39d7c515 (patch)
treed99556d76ffffefc28a58b4d42115dfcd7ad8c8f /std/testing/asserts_test.ts
parent7f591c37835be55b8a426cca61e677fd62c23c93 (diff)
test: add actual error class to fail message (#4305)
Diffstat (limited to 'std/testing/asserts_test.ts')
-rw-r--r--std/testing/asserts_test.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index 3a846417a..558ce1578 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -230,6 +230,24 @@ test(function testingAssertFail(): void {
);
});
+test(function testingAssertFailWithWrongErrorClass(): void {
+ assertThrows(
+ (): void => {
+ //This next assertThrows will throw an AssertionError due to the wrong
+ //expected error class
+ assertThrows(
+ (): void => {
+ fail("foo");
+ },
+ Error,
+ "Failed assertion: foo"
+ );
+ },
+ AssertionError,
+ `Expected error to be instance of "Error", but was "AssertionError"`
+ );
+});
+
const createHeader = (): string[] => [
"",
"",