hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 6f8c14ca7c24a496ccd6bed5275a827058cf61e4
parent beeee1ffbc94a626efaafaf8975a93c05e8ecf76
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 15 Feb 2021 13:33:50 -0500

rt+test: print failed tests summary

Diffstat:
Mrt/+test/start.ha | 23++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/rt/+test/start.ha b/rt/+test/start.ha @@ -28,6 +28,7 @@ export fn start_ha() void = { }; }; + let failures: [](str, str) = []; let npass = 0z, nfail = 0z; print("Running "); print(ztos(ntest)); @@ -39,9 +40,8 @@ export fn start_ha() void = { if (setjmp(&jmp) != 0) { nfail += 1; - print("FAIL: "); - print(reason); - print("\n"); + append(failures, (test_start[i].name, reason)); + print("FAIL\n"); continue; }; test_start[i].func(); @@ -49,6 +49,23 @@ export fn start_ha() void = { npass += 1; print("OK\n"); }; + + if (nfail != 0) { + print("\n"); + print(ztos(nfail)); + if (nfail == 1) { + print(" test failed:\n"); + } else { + print(" tests failed:\n"); + }; + for (let i = 0z; i < nfail; i += 1) { + print(failures[i].0); + print(": "); + print(failures[i].1); + print("\n"); + }; + }; + print("\n"); print(ztos(npass)); print(" passed; ");