summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-23 22:17:39 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-23 23:41:19 +0200
commit24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c (patch)
treefa0c67df4051d433e02a6b910717d44ec9bfda41 /tests
parent7abd5997f41fec38ea1daa9099a9693062f10dbc (diff)
downloadguix-24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c.tar.gz
gexp: Catch and report non-self-quoting gexp inputs.
Previously we would, for example, generate build scripts in the store;
when trying to run them, we'd get a 'read' error due to the presence
of #<foo> syntax in there.

* guix/gexp.scm (gexp->sexp)[self-quoting?]: New procedure.
[reference->sexp]: Check whether the argument in a <gexp-input> box is
self-quoting.  Raise a '&gexp-input-error' condition if it's not.
* tests/gexp.scm ("lower-gexp, non-self-quoting input"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 5c013d838d..50d0948659 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -871,6 +871,13 @@
                    (eq? (derivation-input-derivation (lowered-gexp-guile lexp))
                         (%guile-for-build)))))))
 
+(test-eq "lower-gexp, non-self-quoting input"
+  +
+  (guard (c ((gexp-input-error? c)
+             (gexp-error-invalid-input c)))
+    (run-with-store %store
+      (lower-gexp #~(foo #$+)))))
+
 (test-assertm "gexp->derivation #:references-graphs"
   (mlet* %store-monad
       ((one (text-file "one" (random-text)))