GNU bug report logs - #63538
[PATCH] gnu: services: Error in MODIFY-SERVICES when services don't exist

Previous Next

Package: guix-patches;

Reported by: Brian Cully <bjc <at> spork.org>

Date: Tue, 16 May 2023 15:40:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Brian Cully <bjc <at> spork.org>
To: 63538 <at> debbugs.gnu.org
Cc: Brian Cully <bjc <at> spork.org>
Subject: [bug#63538] [PATCH 2/3] tests: Check for service existence in MODIFY-SERVICES
Date: Tue, 16 May 2023 11:41:41 -0400
* tests/services.scm ("modify-services: delete non-existing service")
("modify-services: change value for non-existing service"): New tests.
---
 tests/services.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/services.scm b/tests/services.scm
index 435f39e59b..5a9cd47489 100644
--- a/tests/services.scm
+++ b/tests/services.scm
@@ -319,6 +319,21 @@ (define-module (test-services)
                  (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)
   (let* ((t1 (service-type (name 't1)
@@ -336,4 +351,20 @@ (define-module (test-services)
                  (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)
-- 
2.40.1





This bug report was last modified 2 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.