diff --git a/zig-code/build-system/unit-testing-skip-foreign/build.zig b/zig-code/build-system/unit-testing-skip-foreign/build.zig index 0ac8180a1..06eca5674 100644 --- a/zig-code/build-system/unit-testing-skip-foreign/build.zig +++ b/zig-code/build-system/unit-testing-skip-foreign/build.zig @@ -29,8 +29,7 @@ pub fn build(b: *std.Build) void { } } -// zig-doctest: build-system --collapseable -- test --summary all - // build=succeed +// additional_option=test // additional_option=--summary // additional_option=all diff --git a/zig-code/build-system/unit-testing-skip-foreign/main.zig b/zig-code/build-system/unit-testing-skip-foreign/main.zig index 42f187fd0..fd32fd0d0 100644 --- a/zig-code/build-system/unit-testing-skip-foreign/main.zig +++ b/zig-code/build-system/unit-testing-skip-foreign/main.zig @@ -1,9 +1,13 @@ -// zig-doctest: syntax --name main const std = @import("std"); test "simple test" { - var list = std.ArrayList(i32).init(std.testing.allocator); - defer list.deinit(); - try list.append(42); + const allocator = std.testing.allocator; + + var list: std.ArrayList(i32) = .empty; + defer list.deinit(allocator); + + try list.append(allocator, 42); try std.testing.expectEqual(@as(i32, 42), list.pop()); } + +// syntax diff --git a/zig-code/build-system/unit-testing/main.zig b/zig-code/build-system/unit-testing/main.zig index c49b4c3c6..fd32fd0d0 100644 --- a/zig-code/build-system/unit-testing/main.zig +++ b/zig-code/build-system/unit-testing/main.zig @@ -1,9 +1,12 @@ const std = @import("std"); test "simple test" { - var list = std.ArrayList(i32).init(std.testing.allocator); - defer list.deinit(); - try list.append(42); + const allocator = std.testing.allocator; + + var list: std.ArrayList(i32) = .empty; + defer list.deinit(allocator); + + try list.append(allocator, 42); try std.testing.expectEqual(@as(i32, 42), list.pop()); }