zig/std/special/test_runner.zig

23 lines
554 B
Zig
Raw Normal View History

const std = @import("std");
const io = std.io;
const builtin = @import("builtin");
const test_fn_list = builtin.__zig_test_fn_slice;
const warn = std.debug.warn;
2017-04-03 21:17:24 -07:00
pub fn main() -> %void {
for (test_fn_list) |test_fn, i| {
warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name);
2018-01-14 07:19:21 -08:00
if (builtin.is_test) {
test_fn.func() catch unreachable;
} else {
test_fn.func() catch |err| {
warn("{}\n", err);
return err;
};
}
warn("OK\n");
}
}