Merge branch 'kristate-skippable-tests-issue1274'
This commit is contained in:
commit
0a32f80d9a
|
@ -125,8 +125,9 @@ pub async fn connect(loop: *Loop, _address: *const std.net.Address) !std.os.File
|
|||
test "listen on a port, send bytes, receive bytes" {
|
||||
if (builtin.os != builtin.Os.linux) {
|
||||
// TODO build abstractions for other operating systems
|
||||
return;
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
const MyServer = struct {
|
||||
tcp_server: Server,
|
||||
|
||||
|
|
|
@ -5,11 +5,25 @@ const test_fn_list = builtin.__zig_test_fn_slice;
|
|||
const warn = std.debug.warn;
|
||||
|
||||
pub fn main() !void {
|
||||
var ok_count: usize = 0;
|
||||
var skip_count: usize = 0;
|
||||
for (test_fn_list) |test_fn, i| {
|
||||
warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name);
|
||||
|
||||
try test_fn.func();
|
||||
|
||||
warn("OK\n");
|
||||
if (test_fn.func()) |_| {
|
||||
ok_count += 1;
|
||||
warn("OK\n");
|
||||
} else |err| switch (err) {
|
||||
error.SkipZigTest => {
|
||||
skip_count += 1;
|
||||
warn("SKIP\n");
|
||||
},
|
||||
else => return err,
|
||||
}
|
||||
}
|
||||
if (ok_count == test_fn_list.len) {
|
||||
warn("All tests passed.\n");
|
||||
} else {
|
||||
warn("{} passed; {} skipped.\n", ok_count, skip_count);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user