diff options
| author | gingerBill <bill@gingerbill.org> | 2021-05-01 23:06:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-05-01 23:06:14 +0100 |
| commit | cf0bf1a7cb395cb334cc456d30af3224fa607ca0 (patch) | |
| tree | c3175fbb67c869184c13756c8f960161a542a2b1 /core/testing/testing.odin | |
| parent | 364e6c9573f35cb32be50cabb898ceb2afa57b88 (diff) | |
Add `testing.fail_now`
Diffstat (limited to 'core/testing/testing.odin')
| -rw-r--r-- | core/testing/testing.odin | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/testing/testing.odin b/core/testing/testing.odin index 8a32ce7c8..ec47ca4d4 100644 --- a/core/testing/testing.odin +++ b/core/testing/testing.odin @@ -25,6 +25,8 @@ T :: struct { w: io.Writer, cleanups: [dynamic]Internal_Cleanup, + + _fail_now: proc() -> !, } @@ -46,6 +48,13 @@ fail :: proc(t: ^T) { t.error_count += 1; } +fail_now :: proc(t: ^T) { + fail(t); + if t._fail_now != nil { + t._fail_now(); + } +} + failed :: proc(t: ^T) -> bool { return t.error_count != 0; } |