authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-01 03:07:31 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-02-01 03:07:31 -08:00
logf629cd04c9907c1f39e527a30e99393c2cc643f3
treebd115f5533b04ed27569ef2947f038b268f8cbb8
parent1e9aa3d5bd87db2a7a661d75eff32c7c6bcbd37e

add template file for tests


2 files changed, 46 insertions(+), 0 deletions(-)

build.zig created+37
...@@ -0,0 +1,37 @@
1const std = @import("std");
2const deps = @import("./deps.zig");
3
4pub fn build(b: *std.build.Builder) void {
5 // Standard target options allows the person running `zig build` to choose
6 // what target to build for. Here we do not override the defaults, which
7 // means any target is allowed, and the default is native. Other options
8 // for restricting supported target set are available.
9 const target = b.standardTargetOptions(.{});
10
11 // Standard release options allow the person running `zig build` to select
12 // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
13 const mode = b.standardReleaseOptions();
14
15 const exe = b.addExecutable("zig-git", "main.zig");
16 exe.setTarget(target);
17 exe.setBuildMode(mode);
18 deps.addAllTo(exe);
19 exe.install();
20
21 const run_cmd = exe.run();
22 run_cmd.step.dependOn(b.getInstallStep());
23 if (b.args) |args| {
24 run_cmd.addArgs(args);
25 }
26
27 const run_step = b.step("run", "Run the app");
28 run_step.dependOn(&run_cmd.step);
29
30 const exe_tests = b.addTest("main.zig");
31 exe_tests.setTarget(target);
32 exe_tests.setBuildMode(mode);
33 deps.addAllTo(exe_tests);
34
35 const test_step = b.step("test", "Run unit tests");
36 test_step.dependOn(&exe_tests.step);
37}
main.zig created+9
...@@ -0,0 +1,9 @@
1const std = @import("std");
2
3pub fn main() anyerror!void {
4 std.log.info("All your codebase are belong to us.", .{});
5}
6
7test "basic test" {
8 try std.testing.expectEqual(10, 3 + 7);
9}