aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-14 14:58:25 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-14 21:39:05 +0200
commit5152d13b51a6418db52ce6dd572cc412e5addf44 (patch)
treef8578b3c70c33ea965ba6709be5940613e705abb
parent87cd0dba2fd221ada9f12ea1cb3d3d151834f498 (diff)
downloadpatches-5152d13b51a6418db52ce6dd572cc412e5addf44.tar
patches-5152d13b51a6418db52ce6dd572cc412e5addf44.tar.gz
services: Export 'service-back-edges'.
* gnu/services.scm: Export 'service-back-edges' and <service-type> accessors. * tests/services.scm ("service-back-edges"): New test.
-rw-r--r--gnu/services.scm5
-rw-r--r--tests/services.scm19
2 files changed, 24 insertions, 0 deletions
diff --git a/gnu/services.scm b/gnu/services.scm
index fdfa569b23..d0fe0ade17 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -38,12 +38,17 @@
service-type
service-type?
+ service-type-name
+ service-type-extensions
+ service-type-compose
+ service-type-extend
service
service?
service-kind
service-parameters
+ service-back-edges
fold-services
service-error?
diff --git a/tests/services.scm b/tests/services.scm
index b4e2cb0b30..ae2d999fee 100644
--- a/tests/services.scm
+++ b/tests/services.scm
@@ -25,6 +25,25 @@
(test-begin "services")
+(test-assert "service-back-edges"
+ (let* ((t1 (service-type (name 't1) (extensions '())
+ (compose +) (extend *)))
+ (t2 (service-type (name 't2)
+ (extensions
+ (list (service-extension t1 (const '()))))
+ (compose +) (extend *)))
+ (t3 (service-type (name 't3)
+ (extensions
+ (list (service-extension t2 identity)
+ (service-extension t1 list)))))
+ (s1 (service t1 #t))
+ (s2 (service t2 #t))
+ (s3 (service t3 #t))
+ (e (service-back-edges (list s1 s2 s3))))
+ (and (lset= eq? (e s1) (list s2 s3))
+ (lset= eq? (e s2) (list s3))
+ (null? (e s3)))))
+
(test-equal "fold-services"
;; Make sure 'fold-services' returns the right result. The numbers come
;; from services of type T3; 'xyz 60' comes from the service of type T2,