diff options
Diffstat (limited to 'core/testing/testing.odin')
| -rw-r--r-- | core/testing/testing.odin | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/testing/testing.odin b/core/testing/testing.odin index a431d8575..ec47ca4d4 100644 --- a/core/testing/testing.odin +++ b/core/testing/testing.odin @@ -25,16 +25,21 @@ T :: struct { w: io.Writer, cleanups: [dynamic]Internal_Cleanup, + + _fail_now: proc() -> !, } error :: proc(t: ^T, args: ..any, loc := #caller_location) { - log(t=t, args=args, loc=loc); + fmt.wprintf(t.w, "%v: ", loc); + fmt.wprintln(t.w, ..args); t.error_count += 1; } errorf :: proc(t: ^T, format: string, args: ..any, loc := #caller_location) { - logf(t=t, format=format, args=args, loc=loc); + fmt.wprintf(t.w, "%v: ", loc); + fmt.wprintf(t.w, format, ..args); + fmt.wprintln(t.w); t.error_count += 1; } @@ -43,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; } |