summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm38
-rw-r--r--tests/inferior.scm13
-rw-r--r--tests/pypi.scm3
3 files changed, 53 insertions, 1 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 9e38816c3d..6a42d3eb57 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -284,6 +284,44 @@
(((thing "out"))
(eq? thing file))))))
+(test-assertm "with-parameters for %current-system"
+ (mlet* %store-monad ((system -> (match (%current-system)
+ ("aarch64-linux" "x86_64-linux")
+ (_ "aarch64-linux")))
+ (drv (package->derivation coreutils system))
+ (obj -> (with-parameters ((%current-system system))
+ coreutils))
+ (result (lower-object obj)))
+ (return (string=? (derivation-file-name drv)
+ (derivation-file-name result)))))
+
+(test-assertm "with-parameters for %current-target-system"
+ (mlet* %store-monad ((target -> "riscv64-linux-gnu")
+ (drv (package->cross-derivation coreutils target))
+ (obj -> (with-parameters
+ ((%current-target-system target))
+ coreutils))
+ (result (lower-object obj)))
+ (return (string=? (derivation-file-name drv)
+ (derivation-file-name result)))))
+
+(test-assert "with-parameters + file-append"
+ (let* ((system (match (%current-system)
+ ("aarch64-linux" "x86_64-linux")
+ (_ "aarch64-linux")))
+ (drv (package-derivation %store coreutils system))
+ (param (make-parameter 7))
+ (exp #~(here we go #$(with-parameters ((%current-system system)
+ (param 42))
+ (if (= (param) 42)
+ (file-append coreutils "/bin/touch")
+ %bootstrap-guile)))))
+ (match (gexp->sexp* exp)
+ (('here 'we 'go (? string? result))
+ (string=? result
+ (string-append (derivation->output-path drv)
+ "/bin/touch"))))))
+
(test-assert "ungexp + ungexp-native"
(let* ((exp (gexp (list (ungexp-native %bootstrap-guile)
(ungexp coreutils)
diff --git a/tests/inferior.scm b/tests/inferior.scm
index f54b6d6037..b4417d8629 100644
--- a/tests/inferior.scm
+++ b/tests/inferior.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -61,6 +61,17 @@
(close-inferior inferior)
(list a (inferior-object? b))))))
+(test-equal "&inferior-exception"
+ '(a b c d)
+ (let ((inferior (open-inferior %top-builddir
+ #:command "scripts/guix")))
+ (guard (c ((inferior-exception? c)
+ (close-inferior inferior)
+ (and (eq? inferior (inferior-exception-inferior c))
+ (inferior-exception-arguments c))))
+ (inferior-eval '(throw 'a 'b 'c 'd) inferior)
+ 'badness)))
+
(test-equal "inferior-packages"
(take (sort (fold-packages (lambda (package lst)
(cons (list (package-name package)
diff --git a/tests/pypi.scm b/tests/pypi.scm
index 43d45f1dd8..19af6e61fb 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -38,7 +38,10 @@
\"license\": \"GNU LGPL\",
\"summary\": \"summary\",
\"home_page\": \"http://example.com\",
+ \"classifiers\": [],
+ \"download_url\": \"\"
},
+ \"urls\": [],
\"releases\": {
\"1.0.0\": [
{