Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ziglang/zig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bb1b7967111d
Choose a base ref
...
head repository: ziglang/zig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0a32f80d9af4
Choose a head ref
  • 6 commits
  • 2 files changed
  • 2 contributors

Commits on Jul 21, 2018

  1. std.special.test_runner.zig: make tests skippable;

    tracking issue #1274;
    
    tests can be skipped by returnning `error.skip` :
    kristopher tate committed Jul 21, 2018
    Copy the full SHA
    df574cc View commit details
  2. std.event.tcp: SKIP test instead of OKing test;

    tracking issue #1274 ;
    kristopher tate committed Jul 21, 2018
    Copy the full SHA
    bc411af View commit details
  3. std.event.tcp: add switch statement in preparation for building-out a…

    …bstractions;
    
    depends on issue #1274 ;
    kristopher tate committed Jul 21, 2018
    Copy the full SHA
    c5c053b View commit details

Commits on Jul 22, 2018

  1. Merge branch 'skippable-tests-issue1274' of https://github.com/krista…

    …te/zig into kristate-skippable-tests-issue1274
    andrewrk committed Jul 22, 2018
    Copy the full SHA
    4429272 View commit details
  2. rename error.skip to error.SkipZigTest

    also print stats at the end of test runner
    andrewrk committed Jul 22, 2018
    Copy the full SHA
    4d9964a View commit details
  3. Copy the full SHA
    0a32f80 View commit details
Showing with 19 additions and 4 deletions.
  1. +2 −1 std/event/tcp.zig
  2. +17 −3 std/special/test_runner.zig
3 changes: 2 additions & 1 deletion std/event/tcp.zig
Original file line number Diff line number Diff line change
@@ -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,

20 changes: 17 additions & 3 deletions std/special/test_runner.zig
Original file line number Diff line number Diff line change
@@ -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);
}
}