grouped comptime param update

This commit is contained in:
2026-07-18 16:48:41 +02:00
parent 9eb7476522
commit f9448363e4
5 changed files with 75 additions and 16 deletions
+5 -6
View File
@@ -1,4 +1,4 @@
debug :: import "@std/debug"
import "@std/debug"
Error :: enum {
expectation_failed
@@ -11,26 +11,25 @@ SourceLocation :: struct {
}
expect func(condition bool, location SourceLocation) void ! Error {
if (!condition) {
if !condition {
debug.print("{s}:{d}:{d}: expectation failed\n", {location.file, location.line, location.column})
return .expectation_failed
}
}
expect_equal func($T type, expected, actual T, location SourceLocation) void ! Error {
if (expected != actual) {
if expected != actual {
debug.print("{s}:{d}:{d}: expected {}, found {}\n", {location.file, location.line, location.column, expected, actual})
return .expectation_failed
}
}
run func(name []u8, callback *func() void ! Error) bool {
debug.print("RUN {s}\n", {name,})
callback() catch |_| {
debug.print("FAIL {s}\n", {name,})
debug.print("{s} [failed]\n", {name,})
return false
}
debug.print("PASS {s}\n", {name,})
debug.print("{s} [ok]\n", {name,})
return true
}