aboutsummaryrefslogtreecommitdiff
path: root/core/testing
diff options
context:
space:
mode:
authorFourteenBrush <naessensarthur2@protonmail.com>2024-01-25 10:08:09 +0100
committerFourteenBrush <naessensarthur2@protonmail.com>2024-01-25 10:08:09 +0100
commit712ae1c5ac73493498aa8e5076d91a6558337117 (patch)
tree6ac34c249062aed5a6f20951cd70d9ec7559106e /core/testing
parente0ac454ed063b643505b691d2bec1823dbb5c6c8 (diff)
Add testing.expectf
Diffstat (limited to 'core/testing')
-rw-r--r--core/testing/testing.odin8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/testing/testing.odin b/core/testing/testing.odin
index 1ba05315c..e6518b249 100644
--- a/core/testing/testing.odin
+++ b/core/testing/testing.odin
@@ -91,6 +91,14 @@ expect :: proc(t: ^T, ok: bool, msg: string = "", loc := #caller_location) -> bo
}
return ok
}
+
+expectf :: proc(t: ^T, ok: bool, format: string, args: ..any, loc := #caller_location) -> bool {
+ if !ok {
+ errorf(t, format, args)
+ }
+ return ok
+}
+
expect_value :: proc(t: ^T, value, expected: $T, loc := #caller_location) -> bool where intrinsics.type_is_comparable(T) {
ok := value == expected || reflect.is_nil(value) && reflect.is_nil(expected)
if !ok {