shithub: mc

Download patch

ref: ac306beff772b0a894ca95e0e0d0fe3029c7f8e4
parent: 8e8d3f3d6f01046782529f853032daca2ab1976e
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Sep 27 07:24:44 EDT 2015

Collect test failures and show them.

    If there are 10 failures or less, show a summary of failed
    tests. Otherwise, show a failure count.

--- a/mbld/test.myr
+++ b/mbld/test.myr
@@ -17,7 +17,7 @@
 const test = {b
 	var tests : (byte[:][:], byte[:])[:]
 	var bincmd
-	var ok
+	var failed : byte[:][:], ok
 
 	/* no implicit tests to run */
 	tests = [][:]
@@ -56,10 +56,12 @@
 	;;
 
 	ok = true
+	failed = [][:]
 	for (c, dir) in tests
 		setdir(b, dir)
 		if !runtest(c)
 			ok = false
+			failed = std.slpush(failed, c[0])
 		;;
 
 	;;
@@ -71,10 +73,25 @@
 	if tests.len == 0
 		->
 	;;
+
+	printfailed(failed)
+	std.slfree(failed)
 	if ok
 		std.put("TESTS PASSED\n")
 	else
 		std.put("TESTS FAILED\n")
+	;;
+}
+
+const printfailed : (f : byte[:][:] -> void) = {failed
+	if failed.len > 10
+		std.put("{} tests failed\n", failed.len)
+	else
+		std.put("FAILURES: ")
+		for t in failed
+			std.put("{} ", t)
+		;;
+		std.put("\n")
 	;;
 }