From a5d78eb64bcb87440a0b3ff25eec5568df0bc47c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 31 Aug 2016 12:38:38 +0200 Subject: services: shepherd: Add 'shepherd-service-lookup-procedure'. * gnu/services/shepherd.scm (shepherd-service-lookup-procedure): New procedure. (shepherd-service-back-edges)[provision->service]: Use it. * tests/services.scm ("shepherd-service-lookup-procedure"): New test. --- tests/services.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/services.scm b/tests/services.scm index 477a197160..12745c8006 100644 --- a/tests/services.scm +++ b/tests/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015 Ludovic Courtès +;;; Copyright © 2015, 2016 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -105,6 +105,15 @@ (fold-services (list s) #:target-type t1) #f))) +(test-assert "shepherd-service-lookup-procedure" + (let* ((s1 (shepherd-service (provision '(s1 s1b)) (start #f))) + (s2 (shepherd-service (provision '(s2 s2b)) (start #f))) + (s3 (shepherd-service (provision '(s3 s3b s3c)) (start #f))) + (lookup (shepherd-service-lookup-procedure (list s1 s2 s3)))) + (and (eq? (lookup 's1) (lookup 's1b) s1) + (eq? (lookup 's2) (lookup 's2b) s2) + (eq? (lookup 's3) (lookup 's3b) s3)))) + (test-assert "shepherd-service-back-edges" (let* ((s1 (shepherd-service (provision '(s1)) (start #f))) (s2 (shepherd-service (provision '(s2)) -- cgit v1.2.3