racket/pretty: fix `print' mode for fxvectors and flvectors

Closes PR 13340
This commit is contained in:
Matthew Flatt 2012-12-03 22:43:14 -07:00
parent ce7b9f7b6f
commit bd1a63a43a
2 changed files with 11 additions and 4 deletions

View File

@ -1096,6 +1096,7 @@
(let ([vecl (flvector->repeatless-list obj)])
(if (and qd (zero? qd))
(pp-pair (cons (make-unquoted 'flvector) vecl)
extra depth
pair? car cdr pair-open pair-close
qd)
(begin
@ -1109,6 +1110,7 @@
(let ([vecl (fxvector->repeatless-list obj)])
(if (and qd (zero? qd))
(pp-pair (cons (make-unquoted 'fxvector) vecl)
extra depth
pair? car cdr pair-open pair-close
qd)
(begin

View File

@ -175,6 +175,11 @@
")"))
#f))
(parameterize ([pretty-print-columns 20]
[print-as-expression #t])
(test "(fxvector\n 1234567890\n 1\n 2\n 3\n 4)" pretty-format (fxvector 1234567890 1 2 3 4))
(test "(flvector\n 1234567890.0\n 1.0\n 2.0\n 3.0\n 4.0)" pretty-format (flvector 1234567890.0 1.0 2.0 3.0 4.0)))
(parameterize ([pretty-print-exact-as-decimal #t])
(test "10" pretty-format 10)
(test "0.5" pretty-format 1/2)