Skip to content

Commit 359865a

Browse files
committed
Add an option for the default reporter, and run tests
1 parent d8f45ee commit 359865a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

build.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn build(b: *std.Build) !void {
1212
const console_width = b.option(u32, "console-width", "Number of columns in the output: affects line wraps. (Defaults to 80)") orelse 80;
1313
const fast_compile = b.option(bool, "fast-compile", "Sacrifices some (rather minor) features for compilation speed") orelse false;
1414
const disable = b.option(bool, "disable", "Disables assertions and test case registration") orelse false;
15+
const default_reporter = b.option([]const u8, "default-reporter", "Choose the reporter to use when it is not specified via the --reporter option. (Defaults to 'console')") orelse "console";
1516

1617
const config = b.addConfigHeader(
1718
.{
@@ -23,7 +24,7 @@ pub fn build(b: *std.Build) !void {
2324
.CATCH_CONFIG_CONSOLE_WIDTH = console_width,
2425
.CATCH_CONFIG_FAST_COMPILE = fast_compile,
2526
.CATCH_CONFIG_DISABLE = disable,
26-
.CATCH_CONFIG_DEFAULT_REPORTER = null,
27+
.CATCH_CONFIG_DEFAULT_REPORTER = default_reporter,
2728
.CATCH_CONFIG_FALLBACK_STRINGIFIER = null,
2829
},
2930
);
@@ -49,8 +50,8 @@ pub fn build(b: *std.Build) !void {
4950
test_exe.addIncludePath(upstream.path("tests/SelfTest"));
5051
test_exe.addCSourceFiles(.{ .root = upstream.path("tests/SelfTest"), .files = &test_files, .flags = &CXXFLAGS });
5152
test_exe.linkLibCpp();
52-
const install_test = b.addInstallArtifact(test_exe, .{});
53-
test_step.dependOn(&install_test.step);
53+
const run_test = b.addRunArtifact(test_exe);
54+
test_step.dependOn(&run_test.step);
5455

5556
const libs = [_]*std.Build.Step.Compile{ catch2, with_main };
5657
for (libs) |lib| {

0 commit comments

Comments
 (0)