From patchwork Fri May 26 22:30:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Cully X-Patchwork-Id: 50352 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D93C127BBEA; Fri, 26 May 2023 23:31:42 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E856127BBE2 for ; Fri, 26 May 2023 23:31:41 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2fxm-0003ud-FF; Fri, 26 May 2023 18:31:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2fxe-0003sa-Ly for guix-patches@gnu.org; Fri, 26 May 2023 18:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2fxe-0003AG-AE for guix-patches@gnu.org; Fri, 26 May 2023 18:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2fxe-00086K-62 for guix-patches@gnu.org; Fri, 26 May 2023 18:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63538] [PATCH v2 2/3] tests: Check for service existence in MODIFY-SERVICES Resent-From: Brian Cully Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 26 May 2023 22:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63538 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63538@debbugs.gnu.org Cc: Brian Cully Received: via spool by 63538-submit@debbugs.gnu.org id=B63538.168514022631076 (code B ref 63538); Fri, 26 May 2023 22:31:02 +0000 Received: (at 63538) by debbugs.gnu.org; 26 May 2023 22:30:26 +0000 Received: from localhost ([127.0.0.1]:50969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2fx3-000855-Ne for submit@debbugs.gnu.org; Fri, 26 May 2023 18:30:26 -0400 Received: from coleridge.kublai.com ([166.84.7.167]:59415 helo=mail.spork.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2fx1-00084k-TJ for 63538@debbugs.gnu.org; Fri, 26 May 2023 18:30:24 -0400 Received: from psyduck.jhoto.kublai.com (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id ADA54BEE2; Fri, 26 May 2023 18:30:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1685140223; bh=t9xUK4xqIkXvRG2F8P0RE1fk55OZAVeF22NNXcTTZpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X7kgb3PmQChuYjQWN+4M4jyia6IMGf17CaJN6ihRjQWanUoiHieTitDT0e1Ff+vfg A2O4YDv07c7L7AHASlkoJUDiAExIgRhevBCrXJIQ4N0o73xgAfZbOdb3E/iJRk5EY5 fSJxb2qNx55FxW6lb7SjZb4/BcloZOMaS+rj1nrM= Date: Fri, 26 May 2023 18:30:16 -0400 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Brian Cully X-ACL-Warn: , Brian Cully via Guix-patches X-Patchwork-Original-From: Brian Cully via Guix-patches via From: Brian Cully Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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)