From 09fcf261c1f66a07891ec2fe80f8652fd286bd3e Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Fri, 26 May 2023 18:30:15 -0400 Subject: [PATCH] tests: Add tests for MODIFY-SERVICES procedure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tests/services.scm ("modify-services: do nothing") ("modify-services: delete service") ("modify-services: change value"): New tests. Signed-off-by: Ludovic Courtès --- tests/services.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/services.scm b/tests/services.scm index 8e35758209..435f39e59b 100644 --- a/tests/services.scm +++ b/tests/services.scm @@ -286,4 +286,54 @@ ((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)