tests: Add tests for MODIFY-SERVICES procedure

* tests/services.scm ("modify-services: do nothing")
("modify-services: delete service")
("modify-services: change value"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Brian Cully 2023-05-26 18:30:15 -04:00 committed by Ludovic Courtès
parent decf5fed65
commit 09fcf261c1
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -286,4 +286,54 @@ (define-module (test-services)
((one) one)
(x x))))
(test-equal "modify-services: do nothing"
'(1 2 3)
(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 t2 2) (service t3 3))))
(sort (map service-value
(modify-services services))
<)))
(test-equal "modify-services: delete service"
'(1 3)
(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 t2 2) (service t3 3))))
(sort (map service-value
(modify-services services
(delete t2)))
<)))
(test-equal "modify-services: change value"
'(1 2 33)
(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 t2 2) (service t3 3))))
(sort (map service-value
(modify-services services
(t3 value => 33)))
<)))
(test-end)