aboutsummaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 0b189b570b..2ec6c8e3ef 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -42,6 +42,7 @@
;; For white-box testing.
(define gexp-inputs (@@ (guix gexp) gexp-inputs))
(define gexp-native-inputs (@@ (guix gexp) gexp-native-inputs))
+(define gexp-outputs (@@ (guix gexp) gexp-outputs))
(define gexp->sexp (@@ (guix gexp) gexp->sexp))
(define* (gexp->sexp* exp #:optional target)
@@ -214,6 +215,31 @@
(equal? (gexp->sexp* exp) ;native
(gexp->sexp* exp "mips64el-linux")))))
+(test-equal "output list"
+ 2
+ (let ((exp (gexp (begin (mkdir (ungexp output))
+ (mkdir (ungexp output "bar"))))))
+ (length (gexp-outputs exp)))) ;XXX: <output-ref> is private
+
+(test-assert "output list, combined gexps"
+ (let* ((exp0 (gexp (mkdir (ungexp output))))
+ (exp1 (gexp (mkdir (ungexp output "foo"))))
+ (exp2 (gexp (begin (display "hi!") (ungexp exp0) (ungexp exp1)))))
+ (and (lset= equal?
+ (append (gexp-outputs exp0) (gexp-outputs exp1))
+ (gexp-outputs exp2))
+ (= 2 (length (gexp-outputs exp2))))))
+
+(test-assert "output list + ungexp-splicing list, combined gexps"
+ (let* ((exp0 (gexp (mkdir (ungexp output))))
+ (exp1 (gexp (mkdir (ungexp output "foo"))))
+ (exp2 (gexp (begin (display "hi!")
+ (ungexp-splicing (list exp0 exp1))))))
+ (and (lset= equal?
+ (append (gexp-outputs exp0) (gexp-outputs exp1))
+ (gexp-outputs exp2))
+ (= 2 (length (gexp-outputs exp2))))))
+
(test-assertm "gexp->file"
(mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
(guile (package-file %bootstrap-guile))