Fixing broken rackunit display tests

original commit: 169a9ea28d6e3e4e3f4642b87ddf7007dde264a0
This commit is contained in:
Jay McCarthy 2013-03-26 06:08:01 -06:00
parent 38f8b0cb3d
commit b7b42f0226
2 changed files with 26 additions and 7 deletions

View File

@ -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)))])))

View File

@ -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