mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-09 11:40:46 -05:00
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.
This commit is contained in:
parent
5b2e842157
commit
4f690b074a
1 changed files with 14 additions and 0 deletions
|
@ -117,6 +117,20 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
|
||||||
step.dependOn(case_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
|
// Don't add the cleanup step, since it may delete outdir while a test case
|
||||||
// is running.
|
// is running.
|
||||||
//const cleanup = b.addRemoveDirTree(outdir);
|
//const cleanup = b.addRemoveDirTree(outdir);
|
||||||
|
|
Loading…
Reference in a new issue