racket / htdp

Other
92 stars 70 forks source link

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

Open samth opened 3 years ago

samth commented 3 years ago

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.

mikesperber commented 3 years ago

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!

samth commented 3 years ago

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