From 1455c7d4a50095e7c8af5a7f3478e953208caea0 Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Tue, 21 Jul 2015 15:12:43 +0900 Subject: [PATCH] Compare expected value and the result only once. Signed-off-by: OGINO Masanori --- contrib/30.test/test.scm | 47 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/contrib/30.test/test.scm b/contrib/30.test/test.scm index 919a8b49..db71bd1d 100644 --- a/contrib/30.test/test.scm +++ b/contrib/30.test/test.scm @@ -39,30 +39,29 @@ (let ((res expr)) (display "case ") (write counter) - (cond - ((equal? res expected) - (display " PASS: ") - (write 'expr) - (display " equals ") - (write expected) - (display "") - (newline) - ) - ((not (equal? res expected)) - (set! failure-counter (+ failure-counter 1)) - (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))))) + (if (equal? res expected) + (begin + (display " PASS: ") + (write 'expr) + (display " equals ") + (write expected) + (display "") + (newline)) + (begin + (set! failure-counter (+ failure-counter 1)) + (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)))))) (define-syntax test-values