racket / rackunit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

rfindler opened this issue · comments

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.

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.

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.

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