gnu: Add DBIx-Class-Schema-Loader.
[jackhill/guix/guix.git] / tests / gexp.scm
CommitLineData
21b679f6 1;;; GNU Guix --- Functional package management for GNU
462a3fa3 2;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
21b679f6
LC
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (test-gexp)
20 #:use-module (guix store)
21 #:use-module (guix monads)
22 #:use-module (guix gexp)
23 #:use-module (guix derivations)
79c0c8cd 24 #:use-module (guix packages)
c1bc358f 25 #:use-module (guix tests)
21b679f6
LC
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages bootstrap)
29 #:use-module (srfi srfi-1)
c8351d9a 30 #:use-module (srfi srfi-34)
21b679f6
LC
31 #:use-module (srfi srfi-64)
32 #:use-module (rnrs io ports)
33 #:use-module (ice-9 match)
2cf0ea0d 34 #:use-module (ice-9 regex)
21b679f6
LC
35 #:use-module (ice-9 popen))
36
37;; Test the (guix gexp) module.
38
39(define %store
c1bc358f 40 (open-connection-for-tests))
21b679f6
LC
41
42;; For white-box testing.
43(define gexp-inputs (@@ (guix gexp) gexp-inputs))
667b2508 44(define gexp-native-inputs (@@ (guix gexp) gexp-native-inputs))
4b23c466 45(define gexp-outputs (@@ (guix gexp) gexp-outputs))
21b679f6
LC
46(define gexp->sexp (@@ (guix gexp) gexp->sexp))
47
667b2508 48(define* (gexp->sexp* exp #:optional target)
68a61e9f 49 (run-with-store %store (gexp->sexp exp
68a61e9f 50 #:target target)
c1bc358f 51 #:guile-for-build (%guile-for-build)))
21b679f6
LC
52
53(define-syntax-rule (test-assertm name exp)
54 (test-assert name
55 (run-with-store %store exp
c1bc358f 56 #:guile-for-build (%guile-for-build))))
21b679f6
LC
57
58\f
59(test-begin "gexp")
60
61(test-equal "no refs"
62 '(display "hello!")
63 (let ((exp (gexp (display "hello!"))))
64 (and (gexp? exp)
65 (null? (gexp-inputs exp))
66 (gexp->sexp* exp))))
67
68(test-equal "unquote"
69 '(display `(foo ,(+ 2 3)))
70 (let ((exp (gexp (display `(foo ,(+ 2 3))))))
71 (and (gexp? exp)
72 (null? (gexp-inputs exp))
73 (gexp->sexp* exp))))
74
75(test-assert "one input package"
76 (let ((exp (gexp (display (ungexp coreutils)))))
77 (and (gexp? exp)
78 (match (gexp-inputs exp)
79 (((p "out"))
80 (eq? p coreutils)))
81 (equal? `(display ,(derivation->output-path
82 (package-derivation %store coreutils)))
83 (gexp->sexp* exp)))))
84
79c0c8cd
LC
85(test-assert "one input origin"
86 (let ((exp (gexp (display (ungexp (package-source coreutils))))))
87 (and (gexp? exp)
88 (match (gexp-inputs exp)
89 (((o "out"))
90 (eq? o (package-source coreutils))))
91 (equal? `(display ,(derivation->output-path
92 (package-source-derivation
93 %store (package-source coreutils))))
94 (gexp->sexp* exp)))))
95
21b679f6
LC
96(test-assert "same input twice"
97 (let ((exp (gexp (begin
98 (display (ungexp coreutils))
99 (display (ungexp coreutils))))))
100 (and (gexp? exp)
101 (match (gexp-inputs exp)
102 (((p "out"))
103 (eq? p coreutils)))
104 (let ((e `(display ,(derivation->output-path
105 (package-derivation %store coreutils)))))
106 (equal? `(begin ,e ,e) (gexp->sexp* exp))))))
107
108(test-assert "two input packages, one derivation, one file"
109 (let* ((drv (build-expression->derivation
110 %store "foo" 'bar
111 #:guile-for-build (package-derivation %store %bootstrap-guile)))
112 (txt (add-text-to-store %store "foo" "Hello, world!"))
113 (exp (gexp (begin
114 (display (ungexp coreutils))
115 (display (ungexp %bootstrap-guile))
116 (display (ungexp drv))
117 (display (ungexp txt))))))
118 (define (match-input thing)
119 (match-lambda
120 ((drv-or-pkg _ ...)
121 (eq? thing drv-or-pkg))))
122
123 (and (gexp? exp)
124 (= 4 (length (gexp-inputs exp)))
125 (every (lambda (input)
126 (find (match-input input) (gexp-inputs exp)))
127 (list drv coreutils %bootstrap-guile txt))
128 (let ((e0 `(display ,(derivation->output-path
129 (package-derivation %store coreutils))))
130 (e1 `(display ,(derivation->output-path
131 (package-derivation %store %bootstrap-guile))))
132 (e2 `(display ,(derivation->output-path drv)))
133 (e3 `(display ,txt)))
134 (equal? `(begin ,e0 ,e1 ,e2 ,e3) (gexp->sexp* exp))))))
135
667b2508
LC
136(test-assert "ungexp + ungexp-native"
137 (let* ((exp (gexp (list (ungexp-native %bootstrap-guile)
138 (ungexp coreutils)
139 (ungexp-native glibc)
140 (ungexp binutils))))
141 (target "mips64el-linux")
142 (guile (derivation->output-path
143 (package-derivation %store %bootstrap-guile)))
144 (cu (derivation->output-path
145 (package-cross-derivation %store coreutils target)))
146 (libc (derivation->output-path
147 (package-derivation %store glibc)))
148 (bu (derivation->output-path
149 (package-cross-derivation %store binutils target))))
150 (and (lset= equal?
151 `((,%bootstrap-guile "out") (,glibc "out"))
152 (gexp-native-inputs exp))
153 (lset= equal?
154 `((,coreutils "out") (,binutils "out"))
155 (gexp-inputs exp))
156 (equal? `(list ,guile ,cu ,libc ,bu)
157 (gexp->sexp* exp target)))))
158
21b679f6
LC
159(test-assert "input list"
160 (let ((exp (gexp (display
161 '(ungexp (list %bootstrap-guile coreutils)))))
162 (guile (derivation->output-path
163 (package-derivation %store %bootstrap-guile)))
164 (cu (derivation->output-path
165 (package-derivation %store coreutils))))
166 (and (lset= equal?
167 `((,%bootstrap-guile "out") (,coreutils "out"))
168 (gexp-inputs exp))
169 (equal? `(display '(,guile ,cu))
170 (gexp->sexp* exp)))))
171
667b2508
LC
172(test-assert "input list + ungexp-native"
173 (let* ((target "mips64el-linux")
174 (exp (gexp (display
175 (cons '(ungexp-native (list %bootstrap-guile coreutils))
176 '(ungexp (list glibc binutils))))))
177 (guile (derivation->output-path
178 (package-derivation %store %bootstrap-guile)))
179 (cu (derivation->output-path
180 (package-derivation %store coreutils)))
181 (xlibc (derivation->output-path
182 (package-cross-derivation %store glibc target)))
183 (xbu (derivation->output-path
184 (package-cross-derivation %store binutils target))))
185 (and (lset= equal?
186 `((,%bootstrap-guile "out") (,coreutils "out"))
187 (gexp-native-inputs exp))
188 (lset= equal?
189 `((,glibc "out") (,binutils "out"))
190 (gexp-inputs exp))
191 (equal? `(display (cons '(,guile ,cu) '(,xlibc ,xbu)))
192 (gexp->sexp* exp target)))))
193
21b679f6
LC
194(test-assert "input list splicing"
195 (let* ((inputs (list (list glibc "debug") %bootstrap-guile))
196 (outputs (list (derivation->output-path
197 (package-derivation %store glibc)
198 "debug")
199 (derivation->output-path
200 (package-derivation %store %bootstrap-guile))))
201 (exp (gexp (list (ungexp-splicing (cons (+ 2 3) inputs))))))
202 (and (lset= equal?
203 `((,glibc "debug") (,%bootstrap-guile "out"))
204 (gexp-inputs exp))
205 (equal? (gexp->sexp* exp)
206 `(list ,@(cons 5 outputs))))))
207
667b2508
LC
208(test-assert "input list splicing + ungexp-native-splicing"
209 (let* ((inputs (list (list glibc "debug") %bootstrap-guile))
210 (exp (gexp (list (ungexp-native-splicing (cons (+ 2 3) inputs))))))
211 (and (lset= equal?
212 `((,glibc "debug") (,%bootstrap-guile "out"))
213 (gexp-native-inputs exp))
214 (null? (gexp-inputs exp))
215 (equal? (gexp->sexp* exp) ;native
216 (gexp->sexp* exp "mips64el-linux")))))
217
4b23c466
LC
218(test-equal "output list"
219 2
220 (let ((exp (gexp (begin (mkdir (ungexp output))
221 (mkdir (ungexp output "bar"))))))
222 (length (gexp-outputs exp)))) ;XXX: <output-ref> is private
223
224(test-assert "output list, combined gexps"
225 (let* ((exp0 (gexp (mkdir (ungexp output))))
226 (exp1 (gexp (mkdir (ungexp output "foo"))))
227 (exp2 (gexp (begin (display "hi!") (ungexp exp0) (ungexp exp1)))))
228 (and (lset= equal?
229 (append (gexp-outputs exp0) (gexp-outputs exp1))
230 (gexp-outputs exp2))
231 (= 2 (length (gexp-outputs exp2))))))
232
7e75a673
LC
233(test-equal "output list, combined gexps, duplicate output"
234 1
235 (let* ((exp0 (gexp (mkdir (ungexp output))))
236 (exp1 (gexp (begin (mkdir (ungexp output)) (ungexp exp0))))
237 (exp2 (gexp (begin (mkdir (ungexp output)) (ungexp exp1)))))
238 (length (gexp-outputs exp2))))
239
f9efe568
LC
240(test-assert "output list + ungexp-splicing list, combined gexps"
241 (let* ((exp0 (gexp (mkdir (ungexp output))))
242 (exp1 (gexp (mkdir (ungexp output "foo"))))
243 (exp2 (gexp (begin (display "hi!")
244 (ungexp-splicing (list exp0 exp1))))))
245 (and (lset= equal?
246 (append (gexp-outputs exp0) (gexp-outputs exp1))
247 (gexp-outputs exp2))
248 (= 2 (length (gexp-outputs exp2))))))
249
21b679f6
LC
250(test-assertm "gexp->file"
251 (mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
252 (guile (package-file %bootstrap-guile))
253 (sexp (gexp->sexp exp))
254 (drv (gexp->file "foo" exp))
255 (out -> (derivation->output-path drv))
256 (done (built-derivations (list drv)))
257 (refs ((store-lift references) out)))
258 (return (and (equal? sexp (call-with-input-file out read))
259 (equal? (list guile) refs)))))
260
261(test-assertm "gexp->derivation"
262 (mlet* %store-monad ((file (text-file "foo" "Hello, world!"))
263 (exp -> (gexp
264 (begin
265 (mkdir (ungexp output))
266 (chdir (ungexp output))
267 (symlink
268 (string-append (ungexp %bootstrap-guile)
269 "/bin/guile")
270 "foo")
271 (symlink (ungexp file)
272 (ungexp output "2nd")))))
273 (drv (gexp->derivation "foo" exp))
274 (out -> (derivation->output-path drv))
275 (out2 -> (derivation->output-path drv "2nd"))
276 (done (built-derivations (list drv)))
277 (refs ((store-lift references) out))
278 (refs2 ((store-lift references) out2))
279 (guile (package-file %bootstrap-guile "bin/guile")))
280 (return (and (string=? (readlink (string-append out "/foo")) guile)
281 (string=? (readlink out2) file)
282 (equal? refs (list (dirname (dirname guile))))
283 (equal? refs2 (list file))))))
284
ce45eb4c
LC
285(test-assertm "gexp->derivation vs. grafts"
286 (mlet* %store-monad ((p0 -> (dummy-package "dummy"
287 (arguments
288 '(#:implicit-inputs? #f))))
289 (r -> (package (inherit p0) (name "DuMMY")))
290 (p1 -> (package (inherit p0) (replacement r)))
291 (exp0 -> (gexp (frob (ungexp p0) (ungexp output))))
292 (exp1 -> (gexp (frob (ungexp p1) (ungexp output))))
293 (void (set-guile-for-build %bootstrap-guile))
294 (drv0 (gexp->derivation "t" exp0))
295 (drv1 (gexp->derivation "t" exp1))
296 (drv1* (gexp->derivation "t" exp1 #:graft? #f)))
297 (return (and (not (string=? (derivation->output-path drv0)
298 (derivation->output-path drv1)))
299 (string=? (derivation->output-path drv0)
300 (derivation->output-path drv1*))))))
301
21b679f6
LC
302(test-assertm "gexp->derivation, composed gexps"
303 (mlet* %store-monad ((exp0 -> (gexp (begin
304 (mkdir (ungexp output))
305 (chdir (ungexp output)))))
306 (exp1 -> (gexp (symlink
307 (string-append (ungexp %bootstrap-guile)
308 "/bin/guile")
309 "foo")))
310 (exp -> (gexp (begin (ungexp exp0) (ungexp exp1))))
311 (drv (gexp->derivation "foo" exp))
312 (out -> (derivation->output-path drv))
313 (done (built-derivations (list drv)))
314 (guile (package-file %bootstrap-guile "bin/guile")))
315 (return (string=? (readlink (string-append out "/foo"))
316 guile))))
317
5d098459
LC
318(test-assertm "gexp->derivation, default system"
319 ;; The default system should be the one at '>>=' time, not the one at
320 ;; invocation time. See <http://bugs.gnu.org/18002>.
321 (let ((system (%current-system))
322 (mdrv (parameterize ((%current-system "foobar64-linux"))
323 (gexp->derivation "foo"
324 (gexp
325 (mkdir (ungexp output)))))))
326 (mlet %store-monad ((drv mdrv))
327 (return (string=? system (derivation-system drv))))))
328
68a61e9f
LC
329(test-assertm "gexp->derivation, cross-compilation"
330 (mlet* %store-monad ((target -> "mips64el-linux")
331 (exp -> (gexp (list (ungexp coreutils)
332 (ungexp output))))
333 (xdrv (gexp->derivation "foo" exp
334 #:target target))
335 (refs ((store-lift references)
336 (derivation-file-name xdrv)))
337 (xcu (package->cross-derivation coreutils
338 target))
339 (cu (package->derivation coreutils)))
340 (return (and (member (derivation-file-name xcu) refs)
341 (not (member (derivation-file-name cu) refs))))))
342
667b2508
LC
343(test-assertm "gexp->derivation, ungexp-native"
344 (mlet* %store-monad ((target -> "mips64el-linux")
345 (exp -> (gexp (list (ungexp-native coreutils)
346 (ungexp output))))
347 (xdrv (gexp->derivation "foo" exp
348 #:target target))
349 (drv (gexp->derivation "foo" exp)))
350 (return (string=? (derivation-file-name drv)
351 (derivation-file-name xdrv)))))
352
353(test-assertm "gexp->derivation, ungexp + ungexp-native"
354 (mlet* %store-monad ((target -> "mips64el-linux")
355 (exp -> (gexp (list (ungexp-native coreutils)
356 (ungexp glibc)
357 (ungexp output))))
358 (xdrv (gexp->derivation "foo" exp
359 #:target target))
360 (refs ((store-lift references)
361 (derivation-file-name xdrv)))
362 (xglibc (package->cross-derivation glibc target))
363 (cu (package->derivation coreutils)))
364 (return (and (member (derivation-file-name cu) refs)
365 (member (derivation-file-name xglibc) refs)))))
366
367(test-assertm "gexp->derivation, ungexp-native + composed gexps"
368 (mlet* %store-monad ((target -> "mips64el-linux")
369 (exp0 -> (gexp (list 1 2
370 (ungexp coreutils))))
371 (exp -> (gexp (list 0 (ungexp-native exp0))))
372 (xdrv (gexp->derivation "foo" exp
373 #:target target))
374 (drv (gexp->derivation "foo" exp)))
375 (return (string=? (derivation-file-name drv)
376 (derivation-file-name xdrv)))))
377
6fd1a796
LC
378(test-assertm "gexp->derivation, store copy"
379 (let ((build-one #~(call-with-output-file #$output
380 (lambda (port)
381 (display "This is the one." port))))
382 (build-two (lambda (one)
383 #~(begin
384 (mkdir #$output)
385 (symlink #$one (string-append #$output "/one"))
386 (call-with-output-file (string-append #$output "/two")
387 (lambda (port)
388 (display "This is the second one." port))))))
b53833b2
LC
389 (build-drv #~(begin
390 (use-modules (guix build store-copy))
6fd1a796 391
b53833b2
LC
392 (mkdir #$output)
393 (populate-store '("graph") #$output))))
6fd1a796
LC
394 (mlet* %store-monad ((one (gexp->derivation "one" build-one))
395 (two (gexp->derivation "two" (build-two one)))
b53833b2 396 (drv (gexp->derivation "store-copy" build-drv
6fd1a796 397 #:references-graphs
b53833b2 398 `(("graph" ,two))
6fd1a796
LC
399 #:modules
400 '((guix build store-copy)
401 (guix build utils))))
402 (ok? (built-derivations (list drv)))
403 (out -> (derivation->output-path drv)))
404 (let ((one (derivation->output-path one))
405 (two (derivation->output-path two)))
406 (return (and ok?
407 (file-exists? (string-append out "/" one))
408 (file-exists? (string-append out "/" two))
409 (file-exists? (string-append out "/" two "/two"))
410 (string=? (readlink (string-append out "/" two "/one"))
411 one)))))))
412
aa72d9af
LC
413(test-assertm "imported-files"
414 (mlet* %store-monad
415 ((files -> `(("x" . ,(search-path %load-path "ice-9/q.scm"))
416 ("a/b/c" . ,(search-path %load-path
417 "guix/derivations.scm"))
418 ("p/q" . ,(search-path %load-path "guix.scm"))
419 ("p/z" . ,(search-path %load-path "guix/store.scm"))))
420 (drv (imported-files files)))
421 (mbegin %store-monad
422 (built-derivations (list drv))
423 (let ((dir (derivation->output-path drv)))
424 (return
425 (every (match-lambda
426 ((path . source)
427 (equal? (call-with-input-file (string-append dir "/" path)
428 get-bytevector-all)
429 (call-with-input-file source
430 get-bytevector-all))))
431 files))))))
432
433(test-assertm "gexp->derivation #:modules"
434 (mlet* %store-monad
435 ((build -> #~(begin
436 (use-modules (guix build utils))
437 (mkdir-p (string-append #$output "/guile/guix/nix"))
438 #t))
439 (drv (gexp->derivation "test-with-modules" build
440 #:modules '((guix build utils)))))
441 (mbegin %store-monad
442 (built-derivations (list drv))
443 (let* ((p (derivation->output-path drv))
444 (s (stat (string-append p "/guile/guix/nix"))))
445 (return (eq? (stat:type s) 'directory))))))
446
b53833b2
LC
447(test-assertm "gexp->derivation #:references-graphs"
448 (mlet* %store-monad
449 ((one (text-file "one" "hello, world"))
450 (two (gexp->derivation "two"
451 #~(symlink #$one #$output:chbouib)))
452 (drv (gexp->derivation "ref-graphs"
453 #~(begin
454 (use-modules (guix build store-copy))
455 (with-output-to-file #$output
456 (lambda ()
457 (write (call-with-input-file "guile"
458 read-reference-graph))))
459 (with-output-to-file #$output:one
460 (lambda ()
461 (write (call-with-input-file "one"
462 read-reference-graph))))
463 (with-output-to-file #$output:two
464 (lambda ()
465 (write (call-with-input-file "two"
466 read-reference-graph)))))
467 #:references-graphs `(("one" ,one)
468 ("two" ,two "chbouib")
469 ("guile" ,%bootstrap-guile))
470 #:modules '((guix build store-copy)
471 (guix build utils))))
472 (ok? (built-derivations (list drv)))
473 (guile-drv (package->derivation %bootstrap-guile))
474 (g-one -> (derivation->output-path drv "one"))
475 (g-two -> (derivation->output-path drv "two"))
476 (g-guile -> (derivation->output-path drv)))
477 (return (and ok?
478 (equal? (call-with-input-file g-one read) (list one))
479 (equal? (call-with-input-file g-two read)
480 (list one (derivation->output-path two "chbouib")))
481 (equal? (call-with-input-file g-guile read)
482 (list (derivation->output-path guile-drv)))))))
483
c8351d9a
LC
484(test-assertm "gexp->derivation #:allowed-references"
485 (mlet %store-monad ((drv (gexp->derivation "allowed-refs"
486 #~(begin
487 (mkdir #$output)
488 (chdir #$output)
489 (symlink #$output "self")
490 (symlink #$%bootstrap-guile
491 "guile"))
492 #:allowed-references
493 (list "out" %bootstrap-guile))))
494 (built-derivations (list drv))))
495
496(test-assert "gexp->derivation #:allowed-references, disallowed"
497 (let ((drv (run-with-store %store
498 (gexp->derivation "allowed-refs"
499 #~(begin
500 (mkdir #$output)
501 (chdir #$output)
502 (symlink #$%bootstrap-guile "guile"))
503 #:allowed-references '()))))
504 (guard (c ((nix-protocol-error? c) #t))
505 (build-derivations %store (list drv))
506 #f)))
507
c17b5ab4 508(define shebang
c1bc358f 509 (string-append "#!" (derivation->output-path (%guile-for-build))
c17b5ab4
LC
510 "/bin/guile --no-auto-compile"))
511
512;; If we're going to hit the silly shebang limit (128 chars on Linux-based
513;; systems), then skip the following test.
514(test-skip (if (> (string-length shebang) 127) 1 0))
515
21b679f6
LC
516(test-assertm "gexp->script"
517 (mlet* %store-monad ((n -> (random (expt 2 50)))
518 (exp -> (gexp
519 (system*
520 (string-append (ungexp %bootstrap-guile)
521 "/bin/guile")
522 "-c" (object->string
523 '(display (expt (ungexp n) 2))))))
524 (drv (gexp->script "guile-thing" exp
525 #:guile %bootstrap-guile))
526 (out -> (derivation->output-path drv))
527 (done (built-derivations (list drv))))
528 (let* ((pipe (open-input-pipe out))
529 (str (get-string-all pipe)))
530 (return (and (zero? (close-pipe pipe))
531 (= (expt n 2) (string->number str)))))))
532
462a3fa3
LC
533(test-assert "text-file*"
534 (let ((references (store-lift references)))
535 (run-with-store %store
536 (mlet* %store-monad
537 ((drv (package->derivation %bootstrap-guile))
538 (guile -> (derivation->output-path drv))
539 (file (text-file "bar" "This is bar."))
540 (text (text-file* "foo"
541 %bootstrap-guile "/bin/guile "
542 `(,%bootstrap-guile "out") "/bin/guile "
543 drv "/bin/guile "
544 file))
545 (done (built-derivations (list text)))
546 (out -> (derivation->output-path text))
547 (refs (references out)))
548 ;; Make sure we get the right references and the right content.
549 (return (and (lset= string=? refs (list guile file))
550 (equal? (call-with-input-file out get-string-all)
551 (string-append guile "/bin/guile "
552 guile "/bin/guile "
553 guile "/bin/guile "
554 file)))))
555 #:guile-for-build (package-derivation %store %bootstrap-guile))))
556
2cf0ea0d
LC
557(test-assert "printer"
558 (string-match "^#<gexp \\(string-append .*#<package coreutils.*\
559 \"/bin/uname\"\\) [[:xdigit:]]+>$"
560 (with-output-to-string
561 (lambda ()
562 (write
563 (gexp (string-append (ungexp coreutils)
564 "/bin/uname")))))))
565
566(test-assert "printer vs. ungexp-splicing"
567 (string-match "^#<gexp .* [[:xdigit:]]+>$"
568 (with-output-to-string
569 (lambda ()
570 ;; #~(begin #$@#~())
571 (write
572 (gexp (begin (ungexp-splicing (gexp ())))))))))
573
21b679f6
LC
574(test-equal "sugar"
575 '(gexp (foo (ungexp bar) (ungexp baz "out")
576 (ungexp (chbouib 42))
667b2508
LC
577 (ungexp-splicing (list x y z))
578 (ungexp-native foo) (ungexp-native foo "out")
579 (ungexp-native (chbouib 42))
580 (ungexp-native-splicing (list x y z))))
581 '#~(foo #$bar #$baz:out #$(chbouib 42) #$@(list x y z)
582 #+foo #+foo:out #+(chbouib 42) #+@(list x y z)))
21b679f6
LC
583
584(test-end "gexp")
585
586\f
587(exit (= (test-runner-fail-count (test-runner-current)) 0))
588
589;; Local Variables:
590;; eval: (put 'test-assertm 'scheme-indent-function 1)
591;; End: