summary refs log tree commit diff
path: root/tests/graph.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-27 14:00:48 +0200
committerLudovic Courtès <ludo@gnu.org>2018-03-27 14:51:44 +0200
commitb06a70e05dc6252a3ecb28db5898de7ebc110973 (patch)
tree08ed804b9f76857f02bd0b8ab1f34e13c9a0e026 /tests/graph.scm
parentde0021322d010871d2c144f01f9dc4efc5c231c4 (diff)
downloadguix-b06a70e05dc6252a3ecb28db5898de7ebc110973.tar.gz
graph: Add "module" node type.
* guix/scripts/graph.scm (module-from-package)
(source-module-dependencies*): New procedures.
(%module-node-type): New variable.
(%node-types): Add it.
* guix/modules.scm (source-module-dependencies): Export.
* tests/graph.scm ("module graph"): New test.
* doc/guix.texi (Invoking guix graph): Document it.
Diffstat (limited to 'tests/graph.scm')
-rw-r--r--tests/graph.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/graph.scm b/tests/graph.scm
index 00fd37243c..5faa19298a 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -271,6 +271,24 @@ edges."
                           (list txt out))
                   (equal? edges `((,txt ,out)))))))))))
 
+(test-assert "module graph"
+  (let-values (((backend nodes+edges) (make-recording-backend)))
+    (run-with-store %store
+      (export-graph '((gnu packages guile)) 'port
+                    #:node-type %module-node-type
+                    #:backend backend))
+
+    (let-values (((nodes edges) (nodes+edges)))
+      (and (member '(gnu packages guile)
+                   (match nodes
+                     (((ids labels) ...) ids)))
+           (->bool (and (member (list '(gnu packages guile)
+                                      '(gnu packages libunistring))
+                                edges)
+                        (member (list '(gnu packages guile)
+                                      '(gnu packages bdw-gc))
+                                edges)))))))
+
 (test-assert "node-edges"
   (run-with-store %store
     (let ((packages (fold-packages cons '())))