summary refs log tree commit diff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-05-24 12:05:47 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-05-24 12:05:47 +0200
commitd1a914082b7e53636f9801769ef96218b2125c4b (patch)
tree998805fc59fe0b1bb105b24a6a79fff646257d96 /tests/packages.scm
parent657fb6c947d94cf946f29cd24e88bd080c01ff0a (diff)
parentae548434337cddf9677a4cd52b9370810b2cc9b6 (diff)
downloadguix-d1a914082b7e53636f9801769ef96218b2125c4b.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index aa29758830..930374dabf 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -470,6 +470,14 @@
       (package-derivation %store p)
       #f)))
 
+(let ((dummy (dummy-package "foo" (inputs `(("x" ,(current-module)))))))
+  (test-equal "&package-input-error"
+    (list dummy (current-module))
+    (guard (c ((package-input-error? c)
+               (list (package-error-package c)
+                     (package-error-invalid-input c))))
+      (package-derivation %store dummy))))
+
 (test-assert "reference to non-existent output"
   ;; See <http://bugs.gnu.org/19630>.
   (parameterize ((%graft? #f))
@@ -878,6 +886,33 @@
            (and (build-derivations %store (list drv))
                 (file-exists? (string-append out "/bin/make")))))))
 
+(test-equal "package-mapping"
+  42
+  (let* ((dep       (dummy-package "chbouib"
+                      (native-inputs `(("x" ,grep)))))
+         (p0        (dummy-package "example"
+                      (inputs `(("foo" ,coreutils)
+                                ("bar" ,grep)
+                                ("baz" ,dep)))))
+         (transform (lambda (p)
+                      (package (inherit p) (source 42))))
+         (rewrite   (package-mapping transform))
+         (p1        (rewrite p0)))
+    (and (eq? p1 (rewrite p0))
+         (eqv? 42 (package-source p1))
+         (match (package-inputs p1)
+           ((("foo" dep1) ("bar" dep2) ("baz" dep3))
+            (and (eq? dep1 (rewrite coreutils))   ;memoization
+                 (eq? dep2 (rewrite grep))
+                 (eq? dep3 (rewrite dep))
+                 (eqv? 42
+                       (package-source dep1) (package-source dep2)
+                       (package-source dep3))
+                 (match (package-native-inputs dep3)
+                   ((("x" dep))
+                    (and (eq? dep (rewrite grep))
+                         (package-source dep))))))))))
+
 (test-assert "package-input-rewriting"
   (let* ((dep     (dummy-package "chbouib"
                     (native-inputs `(("x" ,grep)))))