summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEric Bavier <bavier@member.fsf.org>2015-04-24 07:57:51 -0500
committerEric Bavier <bavier@member.fsf.org>2015-05-02 23:15:40 -0500
commitf77bcbc374bb94272c57508dc04fb8599b56a9d8 (patch)
tree0600ecce1018ce385941be46ec446fb4c04a305d /tests
parentf4bdfe7381e91c4a7eb71ef31ca889e36574b889 (diff)
downloadguix-f77bcbc374bb94272c57508dc04fb8599b56a9d8.tar.gz
guix: packages: Add package-direct-sources and package-transitive-sources.
* guix/tests.scm (dummy-origin): New syntax.
* guix/packages.scm (package-direct-sources)
  (package-transitive-sources): New procedures.
* tests/packages.scm ("package-direct-sources, no source")
  ("package-direct-sources, #f source")
  ("package-direct-sources, not input source", "package-direct-sources")
  ("package-transitive-sources"): Test them.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 4e52813659..511ad78b6c 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -155,6 +155,36 @@
           (package-transitive-supported-systems d)
           (package-transitive-supported-systems e))))
 
+(let* ((o (dummy-origin))
+       (u (dummy-origin))
+       (i (dummy-origin))
+       (a (dummy-package "a"))
+       (b (dummy-package "b"
+            (inputs `(("a" ,a) ("i" ,i)))))
+       (c (package (inherit b) (source o)))
+       (d (dummy-package "d"
+            (build-system trivial-build-system)
+            (source u) (inputs `(("c" ,c))))))
+  (test-assert "package-direct-sources, no source"
+    (null? (package-direct-sources a)))
+  (test-equal "package-direct-sources, #f source"
+    (list i)
+    (package-direct-sources b))
+  (test-equal "package-direct-sources, not input source"
+    (list u)
+    (package-direct-sources d))
+  (test-assert "package-direct-sources"
+    (let ((s (package-direct-sources c)))
+      (and (= (length (pk 's-sources s)) 2)
+           (member o s)
+           (member i s))))
+  (test-assert "package-transitive-sources"
+    (let ((s (package-transitive-sources d)))
+      (and (= (length (pk 'd-sources s)) 3)
+           (member o s)
+           (member i s)
+           (member u s)))))
+
 (test-equal "package-transitive-supported-systems, implicit inputs"
   %supported-systems