add test step to build.zig generated by init-exe (#9919)

* added simple test

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

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
This commit is contained in:
Lee Cannon
2021-10-09 08:17:49 +01:00
committed by GitHub
parent 526191bfaf
commit 8e1aa72c69
2 changed files with 10 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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);
}