Commit 8e1aa72c69

Lee Cannon <leecannon@leecannon.xyz>
2021-10-09 09:17:49
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>
1 parent 526191b
Changed files (2)
lib
std
special
init-exe
lib/std/special/init-exe/src/main.zig
@@ -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);
+}
lib/std/special/init-exe/build.zig
@@ -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);
 }