diff options
| author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-12-18 22:05:58 +0900 |
|---|---|---|
| committer | Ry Dahl <ry@tinyclouds.org> | 2019-12-18 08:05:58 -0500 |
| commit | ff6b514a7b1087e7e5f363305cce46b513a3e562 (patch) | |
| tree | 188f1c55442ac6a8ffc1c0d6bab7ae7f98ffe9c7 /std/testing/test.ts | |
| parent | bb24fb74ffe0bb35649e0adbb1473458c8abf71f (diff) | |
Improve empty test case error messages (#3514)
Diffstat (limited to 'std/testing/test.ts')
| -rw-r--r-- | std/testing/test.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/std/testing/test.ts b/std/testing/test.ts index dd6d772f6..56eacdeed 100644 --- a/std/testing/test.ts +++ b/std/testing/test.ts @@ -260,4 +260,34 @@ test("test fn overloading", (): void => { assert(true); }); +test("The name of test case can't be empty", () => { + assertThrows( + () => { + test("", () => {}); + }, + Error, + "The name of test case can't be empty" + ); + assertThrows( + () => { + test({ + name: "", + fn: () => {} + }); + }, + Error, + "The name of test case can't be empty" + ); +}); + +test("test function can't be anonymous", () => { + assertThrows( + () => { + test(function() {}); + }, + Error, + "Test function can't be anonymous" + ); +}); + runIfMain(import.meta); |
