aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-04-28 19:38:18 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-05-01 19:22:52 -0400
commit00ae3592e6d054276b61404808d016dc2ef7ced5 (patch)
treedd8574f8dbc951bb80d367361acad4c250f371df /lib
parentaaef5288f886c86e4257c5c67122a0be8a64c134 (diff)
downloadzig-00ae3592e6d054276b61404808d016dc2ef7ced5.tar.gz
zig-00ae3592e6d054276b61404808d016dc2ef7ced5.zip
test_runner: use const to control verbose output
Diffstat (limited to 'lib')
-rw-r--r--lib/test_runner.zig16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/test_runner.zig b/lib/test_runner.zig
index 20d7b02e26..f5bb0150a7 100644
--- a/lib/test_runner.zig
+++ b/lib/test_runner.zig
@@ -234,25 +234,33 @@ pub fn log(
/// work-in-progress backends can handle it.
pub fn mainSimple() anyerror!void {
const enable_print = false;
+ const print_all = false;
var passed: u64 = 0;
var skipped: u64 = 0;
var failed: u64 = 0;
const stderr = if (enable_print) std.io.getStdErr() else {};
for (builtin.test_functions) |test_fn| {
+ if (enable_print and print_all) {
+ stderr.writeAll(test_fn.name) catch {};
+ stderr.writeAll("... ") catch {};
+ }
test_fn.func() catch |err| {
- if (enable_print) stderr.writeAll(test_fn.name) catch {};
+ if (enable_print and !print_all) {
+ stderr.writeAll(test_fn.name) catch {};
+ stderr.writeAll("... ") catch {};
+ }
if (err != error.SkipZigTest) {
- if (enable_print) stderr.writeAll("... FAIL\n") catch {};
+ if (enable_print) stderr.writeAll("FAIL\n") catch {};
failed += 1;
if (!enable_print) return err;
continue;
}
- if (enable_print) stderr.writeAll("... SKIP\n") catch {};
+ if (enable_print) stderr.writeAll("SKIP\n") catch {};
skipped += 1;
continue;
};
- //if (enable_print) stderr.writeAll("... PASS\n") catch {};
+ if (enable_print and print_all) stderr.writeAll("PASS\n") catch {};
passed += 1;
}
if (enable_print) {