mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-19 19:20:23 +02:00
Fix pretty-print with a per-line prefix
* module/ice-9/pretty-print.scm (pretty-print): Include the per-line prefix in the indent. * test-suite/tests/print.test ("pretty-print"): Add test.
This commit is contained in:
parent
75cd95060f
commit
437e5ac43d
2 changed files with 19 additions and 2 deletions
|
@ -114,7 +114,7 @@ port directly after OBJ, like (pretty-print OBJ PORT)."
|
|||
((< to col)
|
||||
(put-string port "\n")
|
||||
(put-string port per-line-prefix)
|
||||
(spaces to))
|
||||
(spaces (- to (string-length per-line-prefix))))
|
||||
(else
|
||||
(spaces (- to col))))))
|
||||
|
||||
|
|
|
@ -127,7 +127,24 @@
|
|||
" (1\n"
|
||||
" (0\n"
|
||||
" 0))))))))))\n")
|
||||
#:width 10)))
|
||||
#:width 10))
|
||||
|
||||
(pass-if "prefix"
|
||||
(prints? (9 (8 (7 (6 (5 (4 (3 (2 (1 (0 0))))))))))
|
||||
(string-append
|
||||
"> (9\n"
|
||||
"> (8\n"
|
||||
"> (7\n"
|
||||
"> (6\n"
|
||||
"> (5\n"
|
||||
"> (4\n"
|
||||
"> (3\n"
|
||||
"> (2\n"
|
||||
"> (1\n"
|
||||
"> (0\n"
|
||||
"> 0))))))))))\n")
|
||||
#:width 10
|
||||
#:per-line-prefix "> ")))
|
||||
|
||||
|
||||
(with-test-prefix "truncated-print"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue