summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-06-22 23:39:50 +0200
committerLudovic Courtès <ludo@gnu.org>2022-06-22 23:42:30 +0200
commit2ccbf3a45ccb5b1ac469f3d429faf4c51c56f38a (patch)
treefb2923635bb6ef74079708720a67a8e463f5c58e /tests
parentc9d78e40749fd5348c2776b88a793d76df111cc0 (diff)
downloadguix-2ccbf3a45ccb5b1ac469f3d429faf4c51c56f38a.tar.gz
style: Keep values next to their keyword.
This ensures we print '#:key value' rather than insert a newline
between '#:key' and 'value' as was the case before.

* guix/scripts/style.scm (pretty-print-with-comments)[print-sequence]:
When ITEM is a keyword, loop with FIRST? = true.
* tests/style.scm: Add test.
Diffstat (limited to 'tests')
-rw-r--r--tests/style.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/style.scm b/tests/style.scm
index 41f7e31cce..48d975df94 100644
--- a/tests/style.scm
+++ b/tests/style.scm
@@ -492,6 +492,18 @@ mnopqrstuvwxyz.\")"
    '(#:phases %standard-phases
      #:tests? #f)))")
 
+;; '#:key value' is kept on the same line.
+(test-pretty-print "\
+(package
+  (name \"keyword-value-same-line\")
+  (arguments
+   (list #:phases #~(modify-phases %standard-phases
+                      (add-before 'x 'y
+                        (lambda* (#:key inputs #:allow-other-keys)
+                          (foo bar baz))))
+         #:make-flags #~'(\"ANSWER=42\")
+         #:tests? #f)))")
+
 (test-equal "pretty-print-with-comments, canonicalize-comment"
   "\
 (list abc