all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Brian Cully via Guix-patches via <guix-patches@gnu.org>
To: 63538@debbugs.gnu.org
Cc: Brian Cully <bjc@spork.org>
Subject: [bug#63538] [PATCH v2 2/3] tests: Check for service existence in MODIFY-SERVICES
Date: Fri, 26 May 2023 18:30:16 -0400	[thread overview]
Message-ID: <d98b767a2772bcdc4e09de87e19612dea5424862.1685140217.git.bjc@spork.org> (raw)
In-Reply-To: <d289f6bcc270806e2384f2443703ed135dc4c111.1685140217.git.bjc@spork.org>

* tests/services.scm ("modify-services: delete non-existing service")
("modify-services: change value for non-existing service"): New tests.
---
 tests/services.scm | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/tests/services.scm b/tests/services.scm
index 435f39e59b..8cdb1b2a31 100644
--- a/tests/services.scm
+++ b/tests/services.scm
@@ -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)
-- 
2.40.1





  reply	other threads:[~2023-05-26 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 15:39 [bug#63538] [PATCH 1/3] tests: Add tests for MODIFY-SERVICES procedure Brian Cully via Guix-patches via
2023-05-26 22:30 ` [bug#63538] [PATCH v2 " Brian Cully via Guix-patches via
2023-05-26 22:30   ` Brian Cully via Guix-patches via [this message]
2023-05-26 22:30   ` [bug#63538] [PATCH v2 3/3] gnu: services: Error in MODIFY-SERVICES when services don't exist Brian Cully via Guix-patches via
2023-06-02 14:22     ` bug#63538: [PATCH] " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d98b767a2772bcdc4e09de87e19612dea5424862.1685140217.git.bjc@spork.org \
    --to=guix-patches@gnu.org \
    --cc=63538@debbugs.gnu.org \
    --cc=bjc@spork.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.