summaryrefslogtreecommitdiff
path: root/tests/read-print.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-03-16 22:18:52 +0100
committerLudovic Courtès <ludo@gnu.org>2023-03-16 23:03:18 +0100
commit83128f00e9149f3c1bcd4450eb0ed3620a37149c (patch)
tree303625d63ded887166ced2f9fe8bd46014c3d0bf /tests/read-print.scm
parent8f219e658d8d2d89a2d6ec10729099130791a3a2 (diff)
read-print: 'read-with-comments' reads comments within gexps.
Fixes <https://issues.guix.gnu.org/62059>. Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>. * guix/read-print.scm (read-with-comments): Special-case #~, #$, and #+. * tests/read-print.scm: Add two tests.
Diffstat (limited to 'tests/read-print.scm')
-rw-r--r--tests/read-print.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/read-print.scm b/tests/read-print.scm
index 952b3e6585..f4627e076a 100644
--- a/tests/read-print.scm
+++ b/tests/read-print.scm
@@ -232,6 +232,21 @@ mnopqrstuvwxyz.\")"
(replace \"gmp\" gmp))")
(test-pretty-print "\
+#~(modify-phases phases
+ (add-after 'whatever 'something-else
+ (lambda _
+ ;; This comment appears inside a gexp.
+ 42)))")
+
+(test-pretty-print "\
+#~(list #$@(list coreutils ;yup
+ grep) ;margin comment
+ #+sed
+
+ ;; Line comment.
+ #$grep)")
+
+(test-pretty-print "\
(package
;; Here 'sha256', 'base32', and 'arguments' must be
;; immediately followed by a newline.