2017-10-31 08:47:55 +00:00
|
|
|
const std = @import("std");
|
|
|
|
const io = std.io;
|
2017-05-01 18:12:38 +01:00
|
|
|
const builtin = @import("builtin");
|
2019-04-02 16:11:42 +01:00
|
|
|
const test_fn_list = builtin.test_functions;
|
2016-02-04 01:02:01 +00:00
|
|
|
|
2019-10-18 02:46:41 +01:00
|
|
|
pub fn main() anyerror!void {
|
2018-07-22 04:43:43 +01:00
|
|
|
var ok_count: usize = 0;
|
|
|
|
var skip_count: usize = 0;
|
2019-10-18 02:46:41 +01:00
|
|
|
var progress = std.Progress{};
|
|
|
|
const root_node = progress.start("Test", test_fn_list.len) catch |err| switch (err) {
|
|
|
|
// TODO still run tests in this case
|
|
|
|
error.TimerUnsupported => @panic("timer unsupported"),
|
|
|
|
};
|
2016-02-04 01:02:01 +00:00
|
|
|
|
2019-10-18 02:46:41 +01:00
|
|
|
for (test_fn_list) |test_fn, i| {
|
|
|
|
var test_node = root_node.start(test_fn.name, null);
|
|
|
|
test_node.activate();
|
2018-07-22 04:43:43 +01:00
|
|
|
if (test_fn.func()) |_| {
|
|
|
|
ok_count += 1;
|
2019-10-18 02:46:41 +01:00
|
|
|
test_node.end();
|
2018-07-22 04:43:43 +01:00
|
|
|
} else |err| switch (err) {
|
|
|
|
error.SkipZigTest => {
|
|
|
|
skip_count += 1;
|
2019-10-18 02:46:41 +01:00
|
|
|
test_node.end();
|
|
|
|
progress.log("{}...SKIP\n", test_fn.name);
|
2018-07-22 04:43:43 +01:00
|
|
|
},
|
2019-10-21 23:35:14 +01:00
|
|
|
else => {
|
|
|
|
progress.log("");
|
|
|
|
return err;
|
|
|
|
},
|
2018-07-22 04:43:43 +01:00
|
|
|
}
|
|
|
|
}
|
2019-10-18 02:46:41 +01:00
|
|
|
root_node.end();
|
|
|
|
if (ok_count != test_fn_list.len) {
|
2019-10-21 23:35:14 +01:00
|
|
|
std.debug.warn("{} passed; {} skipped.\n", ok_count, skip_count);
|
2016-02-04 01:02:01 +00:00
|
|
|
}
|
|
|
|
}
|