aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/tests.zig
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2023-04-24 12:19:00 +0200
committerManlio Perillo <manlio.perillo@gmail.com>2023-04-24 12:19:00 +0200
commit5b2e8421578a02379799415ace72acb85f573bcd (patch)
tree77444fc6899a21910930ad16bcda2532f1fb8c2b /test/tests.zig
parent131772edd7f475b3b2331117ed1d833ab926a156 (diff)
test: change the order of `zig build` options
In test case 1 and 2, move the -Dhealed option before the -Dn option, for consistency. Fix a typo in cmd.setName in test case 1 and 2. Remove a confusing comment in test case 1.
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/tests.zig b/test/tests.zig
index ee38f49..069c3b6 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -30,7 +30,7 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
};
{
- // Test that `zig build -Dn=n -Dhealed test` selects the nth exercise.
+ // Test that `zig build -Dhealed -Dn=n test` selects the nth exercise.
const case_step = createCase(b, "case-1");
var i: usize = 0;
@@ -39,12 +39,11 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
if (ex.skip) continue;
const cmd = b.addSystemCommand(
- &.{ b.zig_exe, "build", b.fmt("-Dn={}", .{i}), "-Dhealed", "test" },
+ &.{ b.zig_exe, "build", "-Dhealed", b.fmt("-Dn={}", .{i}), "test" },
);
- cmd.setName(b.fmt("zig build -D={} -Dhealed test", .{i}));
+ cmd.setName(b.fmt("zig build -Dhealed -Dn={} test", .{i}));
cmd.expectExitCode(0);
- // Some exercise output has an extra space character.
if (ex.check_stdout)
expectStdOutMatch(cmd, ex.output)
else
@@ -57,7 +56,7 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
}
{
- // Test that `zig build -Dn=n -Dhealed test` skips disabled esercises.
+ // Test that `zig build -Dhealed -Dn=n test` skips disabled esercises.
const case_step = createCase(b, "case-2");
var i: usize = 0;
@@ -66,9 +65,9 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
if (!ex.skip) continue;
const cmd = b.addSystemCommand(
- &.{ b.zig_exe, "build", b.fmt("-Dn={}", .{i}), "-Dhealed", "test" },
+ &.{ b.zig_exe, "build", "-Dhealed", b.fmt("-Dn={}", .{i}), "test" },
);
- cmd.setName(b.fmt("zig build -D={} -Dhealed test", .{i}));
+ cmd.setName(b.fmt("zig build -Dhealed -Dn={} test", .{i}));
cmd.expectExitCode(0);
cmd.expectStdOutEqual("");
expectStdErrMatch(cmd, b.fmt("{s} skipped", .{ex.main_file}));