r7rs-test: print all failed tests in the end
This commit is contained in:
parent
d85801e396
commit
64d757d46a
|
@ -47,6 +47,8 @@
|
||||||
(define counter 0)
|
(define counter 0)
|
||||||
(define failure-counter 0)
|
(define failure-counter 0)
|
||||||
|
|
||||||
|
(define fails '())
|
||||||
|
|
||||||
(define (print-statistics)
|
(define (print-statistics)
|
||||||
(newline)
|
(newline)
|
||||||
(display "[0;34mTest Result: ")
|
(display "[0;34mTest Result: ")
|
||||||
|
@ -58,7 +60,11 @@
|
||||||
(display "%)")
|
(display "%)")
|
||||||
(display " [PASS/TOTAL]")
|
(display " [PASS/TOTAL]")
|
||||||
(display "[0;39m")
|
(display "[0;39m")
|
||||||
(newline))
|
(newline)
|
||||||
|
(for-each
|
||||||
|
(lambda (fail)
|
||||||
|
(display fail))
|
||||||
|
fails))
|
||||||
|
|
||||||
(define (test-begin . o)
|
(define (test-begin . o)
|
||||||
(set! test-counter (+ test-counter 1)))
|
(set! test-counter (+ test-counter 1)))
|
||||||
|
@ -85,15 +91,19 @@
|
||||||
)
|
)
|
||||||
((not (equal? res expected))
|
((not (equal? res expected))
|
||||||
(set! failure-counter (+ failure-counter 1))
|
(set! failure-counter (+ failure-counter 1))
|
||||||
(display " [0;31mFAIL: ")
|
(let ((out (open-output-string)))
|
||||||
(write 'expr)
|
(display " [0;31mFAIL: " out)
|
||||||
(newline)
|
(write 'expr out)
|
||||||
(display " expected ")
|
(newline out)
|
||||||
(write expected)
|
(display " expected " out)
|
||||||
(display " but got ")
|
(write expected out)
|
||||||
(write res)
|
(display " but got " out)
|
||||||
(display "[0;39m")
|
(write res out)
|
||||||
(newline)))
|
(display "[0;39m" out)
|
||||||
|
(newline out)
|
||||||
|
(let ((str (get-output-string out)))
|
||||||
|
(set! fails (cons str fails))
|
||||||
|
(display str)))))
|
||||||
(set! counter (+ counter 1))))))
|
(set! counter (+ counter 1))))))
|
||||||
|
|
||||||
(newline)
|
(newline)
|
||||||
|
|
Loading…
Reference in New Issue