| 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,15 +123,9 @@ pub async fn connect(loop: *Loop, _address: *const std.net.Address) !std.os.File |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | test "listen on a port, send bytes, receive bytes" { | 125 | test "listen on a port, send bytes, receive bytes" { |
| 126 | // TODO build abstractions for other operating systems | 126 | if (builtin.os != builtin.Os.linux) { |
| 127 | const skip_test: bool = switch (builtin.os) { | 127 | // TODO build abstractions for other operating systems |
| 128 | builtin.Os.linux => false, | 128 | return error.SkipZigTest; |
| 129 | //builtin.Os.macosx, builtin.Os.ios => false, | ||
| 130 | else => true, | ||
| 131 | }; | ||
| 132 | |||
| 133 | if (skip_test == true) { | ||
| 134 | return error.skip; | ||
| 135 | } | 129 | } |
| 136 | 130 | ||
| 137 | const MyServer = struct { | 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,17 +5,25 @@ const test_fn_list = builtin.__zig_test_fn_slice; |
| 5 | const warn = std.debug.warn; | 5 | const warn = std.debug.warn; |
| 6 | 6 | ||
| 7 | pub fn main() !void { | 7 | pub fn main() !void { |
| 8 | var ok_count: usize = 0; | ||
| 9 | var skip_count: usize = 0; | ||
| 8 | for (test_fn_list) |test_fn, i| { | 10 | for (test_fn_list) |test_fn, i| { |
| 9 | warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name); | 11 | warn("Test {}/{} {}...", i + 1, test_fn_list.len, test_fn.name); |
| 10 | 12 | ||
| 11 | test_fn.func() catch |err| { | 13 | if (test_fn.func()) |_| { |
| 12 | if (err == error.skip) { | 14 | ok_count += 1; |
| 13 | warn("SKIPPED\n"); | 15 | warn("OK\n"); |
| 14 | continue; | 16 | } else |err| switch (err) { |
| 15 | } | 17 | error.SkipZigTest => { |
| 16 | return err; | 18 | skip_count += 1; |
| 17 | }; | 19 | warn("SKIP\n"); |
| 18 | 20 | }, | |
| 19 | warn("OK\n"); | 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 | } |