Skip to content

Commit

Permalink
include more tests in zig build test
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Aug 6, 2023
1 parent 8cbb829 commit 4877f71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ pub fn build(b: *Builder) void {
.optimize = optimize,
.target = target,
});
var tests_tests = b.addTest(.{
const run_main_tests = b.addRunArtifact(main_tests);
const tests_tests = b.addTest(.{
.root_source_file = .{ .path = "src/tests.zig" },
.optimize = optimize,
.target = target,
});
const run_main_tests = b.addRunArtifact(main_tests);
const run_tests_tests = b.addRunArtifact(tests_tests);

const test_step = b.step("test", "Run library tests");
test_step.dependOn(&tests_tests.step);
test_step.dependOn(&run_main_tests.step);
test_step.dependOn(&run_tests_tests.step);
}
2 changes: 0 additions & 2 deletions src/tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,9 @@ test "deserializes an union" {
var p: Payload = undefined;
try deserialize(Payload, ([_]u8{ 1, 1 })[0..], &p);
try expect(p.boolean == true);
std.debug.print("{}\n", .{p.boolean});

try deserialize(Payload, ([_]u8{ 1, 0 })[0..], &p);
try expect(p.boolean == false);
std.debug.print("{}\n", .{p.boolean});

try deserialize(Payload, ([_]u8{ 0, 1, 2, 3, 4 })[0..], &p);
try expect(p.int == 0x04030201);
Expand Down

0 comments on commit 4877f71

Please sign in to comment.