commit 8e1aa72c69cddc9fcd0bd8a3f9f4e9d3a8d002af (tree)
parent 526191bfafe722700323df30647eed0c03fc2403
Author: Lee Cannon <leecannon@leecannon.xyz>
Date: Sat, 9 Oct 2021 08:17:49 +0100
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>
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/lib/std/special/init-exe/build.zig b/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);
}
diff --git a/lib/std/special/init-exe/src/main.zig b/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);
+}