Add testing.fail_now

This commit is contained in:
gingerBill
2021-05-01 23:06:14 +01:00
parent 364e6c9573
commit cf0bf1a7cb
2 changed files with 14 additions and 1 deletions
+9
View File
@@ -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;
}