mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
tests: Check for service existence in MODIFY-SERVICES
* tests/services.scm ("modify-services: delete non-existing service") ("modify-services: change value for non-existing service"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
09fcf261c1
commit
ae707b62e7
1 changed files with 35 additions and 2 deletions
|
@ -303,7 +303,7 @@ (define-module (test-services)
|
|||
<)))
|
||||
|
||||
(test-equal "modify-services: delete service"
|
||||
'(1 3)
|
||||
'(1)
|
||||
(let* ((t1 (service-type (name 't1)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
|
@ -316,11 +316,27 @@ (define-module (test-services)
|
|||
(services (list (service t1 1) (service t2 2) (service t3 3))))
|
||||
(sort (map service-value
|
||||
(modify-services services
|
||||
(delete t3)
|
||||
(delete t2)))
|
||||
<)))
|
||||
|
||||
(test-error "modify-services: delete non-existing service"
|
||||
#t
|
||||
(let* ((t1 (service-type (name 't1)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(t2 (service-type (name 't2)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(t3 (service-type (name 't2)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(services (list (service t1 1) (service t2 2))))
|
||||
(modify-services services
|
||||
(delete t3))))
|
||||
|
||||
(test-equal "modify-services: change value"
|
||||
'(1 2 33)
|
||||
'(2 11 33)
|
||||
(let* ((t1 (service-type (name 't1)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
|
@ -333,7 +349,24 @@ (define-module (test-services)
|
|||
(services (list (service t1 1) (service t2 2) (service t3 3))))
|
||||
(sort (map service-value
|
||||
(modify-services services
|
||||
(t1 value => 11)
|
||||
(t3 value => 33)))
|
||||
<)))
|
||||
|
||||
(test-error "modify-services: change value for non-existing service"
|
||||
#t
|
||||
(let* ((t1 (service-type (name 't1)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(t2 (service-type (name 't2)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(t3 (service-type (name 't3)
|
||||
(extensions '())
|
||||
(description "")))
|
||||
(services (list (service t1 1) (service t3 3))))
|
||||
(map service-value
|
||||
(modify-services services
|
||||
(t2 value => 22)))))
|
||||
|
||||
(test-end)
|
||||
|
|
Loading…
Reference in a new issue