authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-28 19:38:18-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-05-01 19:22:52-04:00
log00ae3592e6d054276b61404808d016dc2ef7ced5
treedd8574f8dbc951bb80d367361acad4c250f371df
parentaaef5288f886c86e4257c5c67122a0be8a64c134

test_runner: use const to control verbose output


1 files changed, 12 insertions(+), 4 deletions(-)

lib/test_runner.zig+12-4
......@@ -234,25 +234,33 @@ pub fn log(
234234/// work-in-progress backends can handle it.
235235pub fn mainSimple() anyerror!void {
236236 const enable_print = false;
237 const print_all = false;
237238
238239 var passed: u64 = 0;
239240 var skipped: u64 = 0;
240241 var failed: u64 = 0;
241242 const stderr = if (enable_print) std.io.getStdErr() else {};
242243 for (builtin.test_functions) |test_fn| {
244 if (enable_print and print_all) {
245 stderr.writeAll(test_fn.name) catch {};
246 stderr.writeAll("... ") catch {};
247 }
243248 test_fn.func() catch |err| {
244 if (enable_print) stderr.writeAll(test_fn.name) catch {};
249 if (enable_print and !print_all) {
250 stderr.writeAll(test_fn.name) catch {};
251 stderr.writeAll("... ") catch {};
252 }
245253 if (err != error.SkipZigTest) {
246 if (enable_print) stderr.writeAll("... FAIL\n") catch {};
254 if (enable_print) stderr.writeAll("FAIL\n") catch {};
247255 failed += 1;
248256 if (!enable_print) return err;
249257 continue;
250258 }
251 if (enable_print) stderr.writeAll("... SKIP\n") catch {};
259 if (enable_print) stderr.writeAll("SKIP\n") catch {};
252260 skipped += 1;
253261 continue;
254262 };
255 //if (enable_print) stderr.writeAll("... PASS\n") catch {};
263 if (enable_print and print_all) stderr.writeAll("PASS\n") catch {};
256264 passed += 1;
257265 }
258266 if (enable_print) {