racket / rackunit

Other
18 stars 34 forks source link

pretty-printing in test failures does not seem to indent enough #159

Open rfindler opened 2 years ago

rfindler commented 2 years ago

In this program:

#lang racket
(require rackunit)
(check-equal? (make-list 20 'xxxx) #f)

I see this output:

--------------------
. FAILURE
name:       check-equal?
location:   34-unsaved-editor:3:0
actual:
  '(xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx
  xxxx)
expected:   #f
--------------------

I think the lines with the xxxx in them (except the first one) need to be two more spaces to the right.

sorawee commented 2 years ago

FWIW, here's code that indents exception printing.

https://github.com/racket/rackunit/commit/1c4730dab73354c2afa743213d2f2f7ff640e9f3

I think printing a value would require doing something similar, unless we can specify to racket/pretty directly that it needs to indent text further.

rfindler commented 2 years ago

FWIW, here's code that indents exception printing.

1c4730d

I think printing a value would require doing something similar, unless we can specify to racket/pretty directly that it needs to indent text further.

This code looks okay to me. The problematic code should be the code that calls pretty-print, I think. That is, I expect the issue to be the way racket/pretty is used, as you say.

samth commented 2 years ago

The call to pretty-print is in rackunit/private/check-info and there is some configuration of parameters in rackunit/private/format.