mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
@@ -4,6 +4,7 @@ import "core:fmt"
|
||||
import "core:io"
|
||||
import "core:time"
|
||||
import "core:intrinsics"
|
||||
import "core:reflect"
|
||||
|
||||
// IMPORTANT NOTE: Compiler requires this layout
|
||||
Test_Signature :: proc(^T)
|
||||
@@ -89,7 +90,7 @@ expect :: proc(t: ^T, ok: bool, msg: string = "", loc := #caller_location) -> bo
|
||||
return ok
|
||||
}
|
||||
expect_value :: proc(t: ^T, value, expected: $T, loc := #caller_location) -> bool where intrinsics.type_is_comparable(T) {
|
||||
ok := value == expected
|
||||
ok := value == expected || reflect.is_nil(value) && reflect.is_nil(expected)
|
||||
if !ok {
|
||||
errorf(t, "expected %v, got %v", expected, value, loc=loc)
|
||||
}
|
||||
@@ -100,4 +101,4 @@ expect_value :: proc(t: ^T, value, expected: $T, loc := #caller_location) -> boo
|
||||
|
||||
set_fail_timeout :: proc(t: ^T, duration: time.Duration, loc := #caller_location) {
|
||||
_fail_timeout(t, duration, loc)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user