summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-07 20:14:20 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-07 20:14:31 +0200
commita3d73f59e35e19561afde1bf60ef881a4e8db0e7 (patch)
tree5ef1d41fdae49ba439d3e10ae615f69abba45e6e /tests
parentd5f0c7cc626a0517237c55848342777623d1bd01 (diff)
downloadguix-a3d73f59e35e19561afde1bf60ef881a4e8db0e7.tar.gz
Add `package-transitive-inputs'; use it to honor propagated inputs.
* guix/packages.scm (package-transitive-inputs): New procedure.
  (package-derivation): Use it to compute INPUTS.

* tests/packages.scm (dummy-package): New macro.
  ("package-transitive-inputs"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index eef7d32a35..d804e0ce83 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -22,6 +22,7 @@
   #:use-module (guix utils)
   #:use-module (guix derivations)
   #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
   #:use-module (distro)
   #:use-module (distro base)
   #:use-module (srfi srfi-26)
@@ -35,6 +36,32 @@
 
 (test-begin "packages")
 
+(define-syntax-rule (dummy-package name* extra-fields ...)
+  (package (name name*) (version "0") (source #f)
+           (build-system gnu-build-system)
+           (description #f) (long-description #f)
+           (home-page #f)
+           extra-fields ...))
+
+(test-assert "package-transitive-inputs"
+  (let* ((a (dummy-package "a"))
+         (b (dummy-package "b"
+              (propagated-inputs `(("a" ,a)))))
+         (c (dummy-package "c"
+              (inputs `(("a" ,a)))))
+         (d (dummy-package "d"
+              (propagated-inputs `(("x" "something.drv")))))
+         (e (dummy-package "e"
+              (inputs `(("b" ,b) ("c" ,c) ("d" ,d))))))
+    (and (null? (package-transitive-inputs a))
+         (equal? `(("a" ,a)) (package-transitive-inputs b))
+         (equal? `(("a" ,a)) (package-transitive-inputs c))
+         (equal? (package-propagated-inputs d)
+                 (package-transitive-inputs d))
+         (equal? `(("b" ,b) ("b/a" ,a) ("c" ,c)
+                   ("d" ,d) ("d/x" "something.drv"))
+                 (pk 'x (package-transitive-inputs e))))))
+
 (test-skip (if (not %store) 1 0))
 
 (test-assert "GNU Hello"
@@ -63,4 +90,5 @@
 
 ;;; Local Variables:
 ;;; eval: (put 'test-assert 'scheme-indent-function 1)
+;;; eval: (put 'dummy-package 'scheme-indent-function 1)
 ;;; End: