From c3a73b8e2b3a276dd87ee27528a1dd52db77e3b8 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Mon, 15 May 2023 00:06:15 +0200 Subject: Added testing exercise. --- test/tests.zig | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/tests.zig') diff --git a/test/tests.zig b/test/tests.zig index f5c3960..b25b29c 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -93,7 +93,7 @@ pub fn addCliTests(b: *std.Build, exercises: []const Exercise) *Step { const case_step = createCase(b, "case-3"); for (exercises[0 .. exercises.len - 1]) |ex| { - if (ex.skip) continue; + if (ex.skip or ex.run_test) continue; if (ex.hint) |hint| { const n = ex.number(); @@ -249,6 +249,21 @@ fn check_output(step: *Step, exercise: Exercise, reader: Reader) !void { return; } + if (exercise.run_test) { + { + const actual = try readLine(reader, &buf) orelse "EOF"; + const expect = b.fmt("Testing {s}...", .{exercise.main_file}); + try check(step, exercise, expect, actual); + } + + { + const actual = try readLine(reader, &buf) orelse "EOF"; + try check(step, exercise, "", actual); + } + + return; + } + { const actual = try readLine(reader, &buf) orelse "EOF"; const expect = b.fmt("Compiling {s}...", .{exercise.main_file}); -- cgit v1.2.3-70-g09d2