htdp icon indicating copy to clipboard operation
htdp copied to clipboard

new check-expect output with large values is hard to read

Open samth opened this issue 3 years ago • 2 comments

Consider this program

#lang htdp/asl

(check-expect (build-list 20 (lambda (x) x))
              (build-list 21 (lambda (x) x)))

It prints:

[samth@huor:~/sw/plt (master) plt] raco test /tmp/d.rkt 
raco test: (submod "/tmp/d.rkt" test)
Ran 1 test.                                                                                                                                                                        
0 tests passed.                                                                                                                                                                    
Check failures:                                                                                                                                                                    
                     ┌──────────────────────────────────────────────────────────┐              ┌─────────────────────────────────────────────────────────────┐                     
        Actual value │ (list 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) │ differs from │ (list 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) │, the expected value.
                     └──────────────────────────────────────────────────────────┘              └─────────────────────────────────────────────────────────────┘                     
        in d.rkt, line 3, column 0         

which is not great in a window that wraps, such as almost every terminal.

samth avatar Nov 25 '20 20:11 samth

It's on my radar, but I'm unsure of a good strategy. Just dropping the boxes is probably not going to work, since test-engine's output (and the translations, and, and ...) all assume alignment.

One possible strategy would be to format the values with limited width.

Suggestions welcome!

mikesperber avatar Nov 28 '20 11:11 mikesperber

When the values are long, just putting them on separate lines and then pretty-printing with limited width would be great.

samth avatar Nov 28 '20 12:11 samth