Skip to content

Commit

Permalink
add test step to build.zig generated by init-exe (ziglang#9919)
Browse files Browse the repository at this point in the history
* added simple test

* Update lib/std/special/init-exe/build.zig

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
  • Loading branch information
leecannon and andrewrk authored Oct 9, 2021
1 parent 526191b commit 8e1aa72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/std/special/init-exe/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ pub fn build(b: *std.build.Builder) void {

const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);

var exe_tests = b.addTest("src/main.zig");
exe_tests.setBuildMode(mode);

const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step);
}
4 changes: 4 additions & 0 deletions lib/std/special/init-exe/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ const std = @import("std");
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
}

test "basic test" {
try std.testing.expectEqual(10, 3 + 7);
}

0 comments on commit 8e1aa72

Please sign in to comment.