diff --git a/collects/rackunit/private/format.rkt b/collects/rackunit/private/format.rkt index 441c498834..b18f5d5a44 100644 --- a/collects/rackunit/private/format.rkt +++ b/collects/rackunit/private/format.rkt @@ -84,7 +84,7 @@ ;; Strip any check-params? is there is an ;; actual/expected check-info in the same stack frame. A ;; stack frame is delimited by occurrence of a check-name? -(define (strip-redundant-params stack) +(define (strip-redundant-params start-stack) (define (binary-check-this-frame? stack) (let loop ([stack stack]) (cond @@ -92,11 +92,11 @@ [(check-name? (car stack)) #f] [(check-actual? (car stack)) #t] [else (loop (cdr stack))]))) - (let loop ([stack stack]) + (let loop ([stack start-stack]) (cond [(null? stack) null] [(check-params? (car stack)) - (if (binary-check-this-frame? stack) + (if (binary-check-this-frame? start-stack) (loop (cdr stack)) (cons (car stack) (loop (cdr stack))))] [else (cons (car stack) (loop (cdr stack)))]))) diff --git a/collects/rackunit/text-ui.rkt b/collects/rackunit/text-ui.rkt index 96c404e076..08bababc5d 100644 --- a/collects/rackunit/text-ui.rkt +++ b/collects/rackunit/text-ui.rkt @@ -116,6 +116,24 @@ (display-exn exn))] [else (void)])) +(define (sort-stack l) + (sort l < + #:key + (λ (info) + (cond + [(check-name? info) + 0] + [(check-location? info) + 1] + [(check-params? info) + 2] + [(check-actual? info) + 3] + [(check-expected? info) + 4] + [else + 5])))) + (define (textui-display-check-info-stack stack [verbose? #f]) (for-each (lambda (info) @@ -149,9 +167,10 @@ (void)] [else (display-check-info info)])) - (if verbose? - stack - (strip-redundant-params stack)))) + (sort-stack + (if verbose? + stack + (strip-redundant-params stack))))) ;; display-verbose-check-info : test-result -> void (define (display-verbose-check-info result) @@ -172,7 +191,7 @@ (display ": ") (write (check-info-value info)))) (newline)) - stack))) + (sort-stack stack)))) ((test-error? result) (display-exn (test-error-result result))) (else