From 09b085a3f54dde30fa6c130532ed806f502db299 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 27 Sep 2009 20:53:07 -0700 Subject: [PATCH] Don't count singleton sub-tests as a separate level. --- tests/unit-testing.scm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/unit-testing.scm b/tests/unit-testing.scm index 73a50a4c2..8620e4f4d 100644 --- a/tests/unit-testing.scm +++ b/tests/unit-testing.scm @@ -75,16 +75,20 @@ USA. (cons (car td) (reverse! (let loop ((test (cdr td)) (name "") (results '())) - (if (thunk? test) - (cons (cons name (run-test-thunk test)) - results) - (do ((tests test (cdr tests)) - (index 0 (+ index 1)) - (results results - (loop (car tests) - (string name "." index) - results))) - ((not (pair? tests)) results))))))) + (cond ((thunk? test) + (cons (cons name (run-test-thunk test)) + results)) + ((and (pair? test) + (null? (cdr test))) + (loop (car test) name results)) + (else + (do ((tests test (cdr tests)) + (index 0 (+ index 1)) + (results results + (loop (car tests) + (string name "." index) + results))) + ((not (pair? tests)) results)))))))) (define (run-test-thunk thunk) (call-with-current-continuation -- 2.25.1