diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-09-23 22:17:39 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-09-23 23:41:19 +0200 |
| commit | 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c (patch) | |
| tree | fa0c67df4051d433e02a6b910717d44ec9bfda41 /tests/gexp.scm | |
| parent | 7abd5997f41fec38ea1daa9099a9693062f10dbc (diff) | |
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/gexp.scm')
| -rw-r--r-- | tests/gexp.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 5c013d838d9..50d09486599 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm | |||
| @@ -871,6 +871,13 @@ | |||
| 871 | (eq? (derivation-input-derivation (lowered-gexp-guile lexp)) | 871 | (eq? (derivation-input-derivation (lowered-gexp-guile lexp)) |
| 872 | (%guile-for-build))))))) | 872 | (%guile-for-build))))))) |
| 873 | 873 | ||
| 874 | (test-eq "lower-gexp, non-self-quoting input" | ||
| 875 | + | ||
| 876 | (guard (c ((gexp-input-error? c) | ||
| 877 | (gexp-error-invalid-input c))) | ||
| 878 | (run-with-store %store | ||
| 879 | (lower-gexp #~(foo #$+))))) | ||
| 880 | |||
| 874 | (test-assertm "gexp->derivation #:references-graphs" | 881 | (test-assertm "gexp->derivation #:references-graphs" |
| 875 | (mlet* %store-monad | 882 | (mlet* %store-monad |
| 876 | ((one (text-file "one" (random-text))) | 883 | ((one (text-file "one" (random-text))) |
