r7rs-test: print all failed tests in the end

This commit is contained in:
Yuichi Nishiwaki 2014-07-15 18:04:53 +09:00
parent d85801e396
commit 64d757d46a
1 changed files with 20 additions and 10 deletions

View File

@ -47,6 +47,8 @@
(define counter 0)
(define failure-counter 0)
(define fails '())
(define (print-statistics)
(newline)
(display "Test Result: ")
@ -58,7 +60,11 @@
(display "%)")
(display " [PASS/TOTAL]")
(display "")
(newline))
(newline)
(for-each
(lambda (fail)
(display fail))
fails))
(define (test-begin . o)
(set! test-counter (+ test-counter 1)))
@ -85,15 +91,19 @@
)
((not (equal? res expected))
(set! failure-counter (+ failure-counter 1))
(display " FAIL: ")
(write 'expr)
(newline)
(display " expected ")
(write expected)
(display " but got ")
(write res)
(display "")
(newline)))
(let ((out (open-output-string)))
(display " FAIL: " out)
(write 'expr out)
(newline out)
(display " expected " out)
(write expected out)
(display " but got " out)
(write res out)
(display "" out)
(newline out)
(let ((str (get-output-string out)))
(set! fails (cons str fails))
(display str)))))
(set! counter (+ counter 1))))))
(newline)