summary refs log tree commit diff
path: root/tests/read-print.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-09-01 22:08:12 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-02 10:49:35 +0200
commit82968362ead0ed59c64ee8a21fec346c9265a149 (patch)
treece9143abf4469b619b37b36792faa7b3820ef4c8 /tests/read-print.scm
parentac9a7f6be9c2e0f2ab218f7a423527490bb6aa9c (diff)
downloadguix-82968362ead0ed59c64ee8a21fec346c9265a149.tar.gz
read-print: Define forms for which \n, \t, etc. are not escaped.
Previously, the pretty-printer would unconditionally leave everything
but double-quotes and backslashes unescaped when rendering a string.
With this change, the previous behavior only applies to forms listed in
%NATURAL-WHITESPACE-STRING-FORMS.

* guix/read-print.scm (%natural-whitespace-string-forms): New variable.
(printed-string): New procedure.
(pretty-print-with-comments): Use it instead of 'escaped-string'.
* tests/read-print.scm: Add test.
Diffstat (limited to 'tests/read-print.scm')
-rw-r--r--tests/read-print.scm3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/read-print.scm b/tests/read-print.scm
index 1b0d865972..ca3f3193f7 100644
--- a/tests/read-print.scm
+++ b/tests/read-print.scm
@@ -187,6 +187,9 @@ expressions."
                 xyz))))")
 
 (test-pretty-print "\
+(string-append \"a\\tb\" \"\\n\")")
+
+(test-pretty-print "\
 (description \"abcdefghijkl
 mnopqrstuvwxyz.\")"
                    #:max-width 30)