Here's an example showing that this test will not behave consistently in 
DrRacket and Racket, because `print` won't.

Is that a bug, or is it a "bad practice (tm)" that I ever use `print` 
programmatically and expect specific output? Take the question as "me learning 
Racket, somewhat chaotically" :-).
(This question arose in the context of another thread, but I'd like the version 
without the context).

```
#lang racket/base

(require rackunit
         racket/format)

(struct posn (x y) #:transparent)
(struct game-state (speed circle target) #:transparent)
(define p (posn 150 100))
(list (game-state p p p))

; This test works in DrRacket and fails with `racket -t $ThisFile`
(check-equal? (~v (list (game-state p p p))) "(list (game-state (posn 150 100) 
(posn 150 100) (posn 150 100)))")
```

The `print` statement produces `(list (game-state (posn 150 100) (posn 150 100) 
(posn 150 100)))` in DrRacket and `(list (game-state #0=(posn 150 100) #0# 
#0#))` otherwise:

```
$ racket -t printing.rkt
(list (game-state #0=(posn 150 100) #0# #0#))
--------------------
FAILURE
actual:     "(list (game-state #0=(posn 150 100) #0# #0#))"
expected:   "(list (game-state (posn 150 100) (posn 150 100) (posn 150 100)))"
name:       check-equal?
location:   
(#<path:/Users/pgiarrusso/AeroFS/Repos/racket-playground-bluevelvet/printing.rkt>
 13 0 279 112)
expression: (check-equal? (~v (list (game-state p p p))) "(list (game-state 
(posn 150 100) (posn 150 100) (posn 150 100)))")

Check failure
--------------------
```

I thought this boiled down to `print-graph`, but it's already false. I also 
looked into `(current-print)`, thanks Benjamin Greenman's suggestion, but that 
seems to only affect the REPL behavior, not print's.

Cheers,
Paolo

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to