mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 15:59:59 +00:00
Added testing exercise.
This commit is contained in:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user