summaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2022-03-03 13:57:03 +0000
committerLudovic Courtès <ludo@gnu.org>2022-03-13 23:18:14 +0100
commit5aec62ee0f69d691c1c1e322029463beb8bfc3cd (patch)
treefa2fa53cac8d5274ac0699b0628186e7e9c67392 /tests/gexp.scm
parentfce9f13b5417b63a6ba5ae03bd8a2ae82ef0a043 (diff)
gexp: Correctly handle unquoting S-exp objects.
This fixes a false-positive in the linter: guix lint -c 'wrapper-inputs' libaio * guix/gexp.scm (gexp->approximate-sexp): Allow the 'thing' in <gexp-input> to be a sexp, without approximation, by testing if it is a record. * tests/gexp.scm ("unquoted sexp (not a gexp!)"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 33c0e4bf8c1..61ed5bc02d9 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1,6 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> 3;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
6;;; 6;;;
@@ -121,6 +121,19 @@
121 (let ((inside (file-append coreutils "/bin/hello"))) 121 (let ((inside (file-append coreutils "/bin/hello")))
122 (gexp->approximate-sexp #~(display '#$inside)))) 122 (gexp->approximate-sexp #~(display '#$inside))))
123 123
124;; See <https://issues.guix.gnu.org/54236>.
125(test-equal "unquoted sexp (not a gexp!)"
126 '(list #(foo) (foo) () "foo" foo #xf00)
127 (let ((inside/vector #(foo))
128 (inside/list '(foo))
129 (inside/empty '())
130 (inside/string "foo")
131 (inside/symbol 'foo)
132 (inside/number #xf00))
133 (gexp->approximate-sexp
134 #~(list #$inside/vector #$inside/list #$inside/empty #$inside/string
135 #$inside/symbol #$inside/number))))
136
124(test-equal "no refs" 137(test-equal "no refs"
125 '(display "hello!") 138 '(display "hello!")
126 (let ((exp (gexp (display "hello!")))) 139 (let ((exp (gexp (display "hello!"))))