aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/tests.zig
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2023-04-24 13:03:52 +0200
committerManlio Perillo <manlio.perillo@gmail.com>2023-04-24 13:03:52 +0200
commit4f690b074a4a2eed4f7062515dfcccae6d1725c8 (patch)
treeaaa2cfc296ff9169456fb7224c7e58b1dbc81810 /test/tests.zig
parent5b2e8421578a02379799415ace72acb85f573bcd (diff)
test: add a test for `zig build -Dn=1`
Add a test for `zig build -Dn=1` in order to test that a broken exercise will print an hint.
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 069c3b6..f91c4fd 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -117,6 +117,20 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
step.dependOn(case_step);
}
+ {
+ // Test that `zig build -Dn=1` prints the hint.
+ const case_step = createCase(b, "case-5");
+
+ const cmd = b.addSystemCommand(&.{ b.zig_exe, "build", "-Dn=1" });
+ cmd.setName("zig build -Dn=1");
+ cmd.expectExitCode(1);
+ expectStdErrMatch(cmd, exercises[0].hint);
+
+ case_step.dependOn(&cmd.step);
+
+ step.dependOn(case_step);
+ }
+
// Don't add the cleanup step, since it may delete outdir while a test case
// is running.
//const cleanup = b.addRemoveDirTree(outdir);