summary refs log tree commit diff
path: root/tests/read-print.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-03-07 11:31:12 +0100
committerLudovic Courtès <ludo@gnu.org>2023-03-07 11:39:50 +0100
commit0a37921d851b94aef6900214098dc5bd62b46e26 (patch)
treee1a34ff234cf7a6637fb91e4fbc0c348113c8328 /tests/read-print.scm
parent11f6bdc547bb80a8c692ce87074058dcd9b0dc8c (diff)
downloadguix-0a37921d851b94aef6900214098dc5bd62b46e26.tar.gz
read-print: Correctly handle comments that follow a list head.
Fixes <https://issues.guix.gnu.org/61013>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/read-print.scm (pretty-print-with-comments)[starts-with-line-comment?]:
New procedure.
Use it when printing a list.
* tests/read-print.scm: Add two tests.
Diffstat (limited to 'tests/read-print.scm')
-rw-r--r--tests/read-print.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/read-print.scm b/tests/read-print.scm
index 79a4101be6..952b3e6585 100644
--- a/tests/read-print.scm
+++ b/tests/read-print.scm
@@ -211,6 +211,15 @@ mnopqrstuvwxyz.\")"
                    #:max-width 33)
 
 (test-pretty-print "\
+(list ;margin comment
+      a b c)")
+
+(test-pretty-print "\
+(list
+ ;; This is a line comment immediately following the list head.
+ #:test-flags #~(list \"-m\" \"not external and not samples\"))")
+
+(test-pretty-print "\
 (modify-phases %standard-phases
   (replace 'build
     ;; Nicely indented in 'modify-phases' context.