aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorManlio Perillo <[email protected]>2023-05-08 20:52:23 +0200
committerManlio Perillo <[email protected]>2023-05-09 11:11:11 +0200
commit728402c64ff1a4ed1e16c4adac704193e973dc37 (patch)
tree948c909a77d7058e614e1d6a7dbb369ec0505311 /test
parent14545778b2432bdaa2d75ce4fb9c82a3d1ef4045 (diff)
downloadziglings-728402c64ff1a4ed1e16c4adac704193e973dc37.tar.xz
ziglings-728402c64ff1a4ed1e16c4adac704193e973dc37.zip
tests: remove the missing functions from RunStep
Use directly the RunStep.addCheck method, instead.
Diffstat (limited to 'test')
-rw-r--r--test/tests.zig32
1 files changed, 5 insertions, 27 deletions
diff --git a/test/tests.zig b/test/tests.zig
index a8a7c4c..702d313 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -84,10 +84,11 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
b.fmt("-Dn={}", .{n}),
"test",
});
+ const expect = b.fmt("{s} skipped", .{ex.main_file});
cmd.setName(b.fmt("zig build -Dhealed -Dn={} test", .{n}));
cmd.expectExitCode(0);
- cmd.expectStdOutEqual("");
- expectStdErrMatch(cmd, b.fmt("{s} skipped", .{ex.main_file}));
+ cmd.addCheck(.{ .expect_stdout_exact = "" });
+ cmd.addCheck(.{ .expect_stderr_match = expect });
cmd.step.dependOn(&heal_step.step);
@@ -172,9 +173,10 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step {
const case_step = createCase(b, "case-5");
const cmd = b.addSystemCommand(&.{ b.zig_exe, "build", "-Dn=1" });
+ const expect = exercises[0].hint orelse "";
cmd.setName("zig build -Dn=1");
cmd.expectExitCode(1);
- expectStdErrMatch(cmd, exercises[0].hint orelse "");
+ cmd.addCheck(.{ .expect_stderr_match = expect });
cmd.step.dependOn(case_step);
@@ -466,27 +468,3 @@ pub fn makeTempPath(b: *Build) ![]const u8 {
return path;
}
-
-//
-// Missing functions from std.Build.RunStep
-//
-
-/// Adds a check for stderr match. Does not add any other checks.
-pub fn expectStdErrMatch(self: *RunStep, bytes: []const u8) void {
- const new_check: RunStep.StdIo.Check = .{
- .expect_stderr_match = self.step.owner.dupe(bytes),
- };
- self.addCheck(new_check);
-}
-
-/// Adds a check for stdout match as well as a check for exit code 0, if
-/// there is not already an expected termination check.
-pub fn expectStdOutMatch(self: *RunStep, bytes: []const u8) void {
- const new_check: RunStep.StdIo.Check = .{
- .expect_stdout_match = self.step.owner.dupe(bytes),
- };
- self.addCheck(new_check);
- if (!self.hasTermCheck()) {
- self.expectExitCode(0);
- }
-}