| author | |
| committer | |
| log | 4d9964a457084d41ba2995082d0e25b195757751 |
| tree | d3ab6917d1707b87fa22ed7d6d2db5c0332258ca |
| parent | 44292721bf6304d77ac34f2aa6c4c00d8d264d6c |
also print stats at the end of test runner2 files changed, 20 insertions(+), 18 deletions(-)
std/event/tcp.zig+3-9| ... | ... | @@ -123,15 +123,9 @@ pub async fn connect(loop: *Loop, _address: *const std.net.Address) !std.os.File |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | test "listen on a port, send bytes, receive bytes" { |
| 126 | // TODO build abstractions for other operating systems | |
| 127 | const skip_test: bool = switch (builtin.os) { | |
| 128 | builtin.Os.linux => false, | |
| 129 | //builtin.Os.macosx, builtin.Os.ios => false, | |
| 130 | else => true, | |
| 131 | }; | |
| 132 | ||
| 133 | if (skip_test == true) { | |
| 134 | return error.skip; | |
| 126 | if (builtin.os != builtin.Os.linux) { | |
| 127 | // TODO build abstractions for other operating systems | |
| 128 | return error.SkipZigTest; | |
| 135 | 129 | } |
| 136 | 130 | |
| 137 | 131 | const MyServer = struct { |
std/special/test_runner.zig+17-9| ... | ... | @@ -5,17 +5,25 @@ const test_fn_list = builtin.__zig_test_fn_slice; |
| 5 | 5 | const warn = std.debug.warn; |
| 6 | 6 | |
| 7 | 7 | pub fn main() !void { |
| 8 | var ok_count: usize = 0; | |
| 9 | var skip_count: usize = 0; | |
| 8 | 10 | for (test_fn_list) |test_fn, i| { |
| 9 | 11 | warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name); |
| 10 | 12 | |
| 11 | test_fn.func() catch |err| { | |
| 12 | if (err == error.skip) { | |
| 13 | warn("SKIPPED\n"); | |
| 14 | continue; | |
| 15 | } | |
| 16 | return err; | |
| 17 | }; | |
| 18 | ||
| 19 | warn("OK\n"); | |
| 13 | if (test_fn.func()) |_| { | |
| 14 | ok_count += 1; | |
| 15 | warn("OK\n"); | |
| 16 | } else |err| switch (err) { | |
| 17 | error.SkipZigTest => { | |
| 18 | skip_count += 1; | |
| 19 | warn("SKIP\n"); | |
| 20 | }, | |
| 21 | else => return err, | |
| 22 | } | |
| 23 | } | |
| 24 | if (ok_count == test_fn_list.len) { | |
| 25 | warn("All tests passed.\n"); | |
| 26 | } else { | |
| 27 | warn("{} passed; {} skipped.\n", ok_count, skip_count); | |
| 20 | 28 | } |
| 21 | 29 | } |