summary refs log tree commit diff
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)
downloadguix-5aec62ee0f69d691c1c1e322029463beb8bfc3cd.tar.gz
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 33c0e4bf8c..61ed5bc02d 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -121,6 +121,19 @@
   (let ((inside (file-append coreutils "/bin/hello")))
     (gexp->approximate-sexp #~(display '#$inside))))
 
+;; See <https://issues.guix.gnu.org/54236>.
+(test-equal "unquoted sexp (not a gexp!)"
+  '(list #(foo) (foo) () "foo" foo #xf00)
+  (let ((inside/vector #(foo))
+        (inside/list '(foo))
+        (inside/empty '())
+        (inside/string "foo")
+        (inside/symbol 'foo)
+        (inside/number #xf00))
+    (gexp->approximate-sexp
+     #~(list #$inside/vector #$inside/list #$inside/empty #$inside/string
+             #$inside/symbol #$inside/number))))
+
 (test-equal "no refs"
   '(display "hello!")
   (let ((exp (gexp (display "hello!"))))