Skip to content

Commit 04aa9df

Browse files
committed
Improves reporting of failures and errors in prim test runner
1 parent bd64a44 commit 04aa9df

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

ports/ports.scm

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,29 @@
241241
(define (display-test-results test-results)
242242
(display "\nTests done - Results\n")
243243
(let
244-
((success-count (count is-success? test-results))
245-
(failure-count (count is-failure? test-results))
246-
(error-count (count is-error? test-results)))
247-
(display (string-append "Success: " success-count ", Failure:" failure-count ", Errors:" error-count "\n"))))
244+
((successes (filter is-success? test-results))
245+
(failures (filter is-failure? test-results))
246+
(errors (filter is-error? test-results)))
247+
(display
248+
(string-append "Success: " (length successes) ", Failure:" (length failures) ", Errors:" (length errors) "\n\n"))
249+
(if (> (length successes) 0)
250+
(begin
251+
(display "Failures:\n")
252+
(for-each
253+
(lambda (test-result)
254+
(display "- " (string-append (test-full-name (test-result-test test-result)) "\n"))
255+
(display "\t" (test-result-exception test-result))
256+
(display "\n\n"))
257+
failures)))
258+
(if (> (length errors) 0)
259+
(begin
260+
(display "Errors:\n")
261+
(for-each
262+
(lambda (test-result)
263+
(display "- " (string-append (test-full-name (test-result-test test-result)) "\n"))
264+
(display "\t" (test-result-exception test-result))
265+
(display "\n\n"))
266+
errors)))))
248267

249268
(define (run-suite suite-name suite-version root-capability only-tests only-capabilities exclude-tests exclude-capabilities)
250269
(display (string-append "Running suite: " suite-name " " suite-version "\n"))

0 commit comments

Comments
 (0)