summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-04-13 17:56:37 +0200
committerLudovic Courtès <ludo@gnu.org>2022-04-14 14:48:20 +0200
commitc9cded095593783a957ea500160587252d5cadf6 (patch)
treeb746ae4f0ab22f6a070ccfe07cf886a7f0cd22cd /tests
parent919cecd00b018d596cf8aca10b370c4d91989be9 (diff)
style: Correctly read dots in pairs and improper lists.
Until now dots were read as symbols. * guix/scripts/style.scm (read-with-comments)[dot]: New variable. [dot?, reverse/dot]: New procedures. Use 'reverse/dot' instead of 'reverse' when reading lists. * tests/style.scm ("read-with-comments: dot notation") ("((a . 1) (b . 2))", "(a b c . boom)"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/style.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/style.scm b/tests/style.scm
index 8c6d37a661..41f7e31cce 100644
--- a/tests/style.scm
+++ b/tests/style.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -377,7 +377,14 @@
(list (package-inputs (@ (my-packages) my-coreutils))
(read-package-field (@ (my-packages) my-coreutils) 'inputs 4)))))
+(test-equal "read-with-comments: dot notation"
+ (cons 'a 'b)
+ (call-with-input-string "(a . b)"
+ read-with-comments))
+
(test-pretty-print "(list 1 2 3 4)")
+(test-pretty-print "((a . 1) (b . 2))")
+(test-pretty-print "(a b c . boom)")
(test-pretty-print "(list 1
2
3