unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Romain GARBAGE <romain.garbage@inria.fr>
To: 74769@debbugs.gnu.org
Cc: ludovic.courtes@inria.fr, Romain GARBAGE <romain.garbage@inria.fr>
Subject: [bug#74769] [PATCH Cuirass v2 1/7] tests: Move procedure definition.
Date: Thu, 12 Dec 2024 16:57:49 +0100	[thread overview]
Message-ID: <20241212155845.27344-1-romain.garbage@inria.fr> (raw)
In-Reply-To: <20241210160824.31748-1-romain.garbage@inria.fr>

* tests/common.scm (specifications-equal?): New variable.
* tests/gitlab.scm (specifications-equal?): Remove variable.
---
 tests/common.scm | 30 +++++++++++++++++++++++++++++-
 tests/gitlab.scm | 24 ------------------------
 2 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/tests/common.scm b/tests/common.scm
index a807498..5054ea0 100644
--- a/tests/common.scm
+++ b/tests/common.scm
@@ -20,7 +20,9 @@
   #:use-module ((cuirass base) #:select (%bridge-socket-file-name))
   #:use-module (cuirass database)
   #:use-module (cuirass parameters)
+  #:use-module (cuirass specification)
   #:use-module (cuirass utils)
+  #:use-module (guix channels)
   #:use-module ((fibers scheduler) #:select (current-scheduler))
   #:use-module (ice-9 popen)
   #:use-module (ice-9 rdelim)
@@ -28,7 +30,8 @@
             retry
             test-init-db!
             with-guix-daemon
-            wait-for-bridge))
+            wait-for-bridge
+            specifications-equal?))
 
 (define %db
   (make-parameter #f))
@@ -121,3 +124,28 @@ Return the socket on success and #f on failure."
                         (sockaddr:path address)
                         (strerror (system-error-errno args)))
                 #f)))))))
+
+(define (specifications-equal? spec1 spec2)
+  "Return true if SPEC2 and SPEC2 are equivalent, false otherwise."
+  (and (eq? (specification-name spec1)
+            (specification-name spec2))
+       (equal? (specification-build spec1)
+               (specification-build spec2))
+       (= (specification-priority spec1)
+          (specification-priority spec2))
+       (= (specification-period spec1)
+          (specification-period spec2))
+       (equal? (specification-systems spec1)
+               (specification-systems spec2))
+       (equal? (map channel-name
+                    (specification-channels spec1))
+               (map channel-name
+                    (specification-channels spec2)))
+       (equal? (map channel-url
+                    (specification-channels spec1))
+               (map channel-url
+                    (specification-channels spec2)))
+       (equal? (map channel-branch
+                    (specification-channels spec1))
+               (map channel-branch
+                    (specification-channels spec2)))))
diff --git a/tests/gitlab.scm b/tests/gitlab.scm
index ca6cad5..adf94cc 100644
--- a/tests/gitlab.scm
+++ b/tests/gitlab.scm
@@ -157,30 +157,6 @@
     }
   }")
 
-(define (specifications-equal? spec1 spec2)
-  (and (eq? (specification-name spec1)
-            (specification-name spec2))
-       (equal? (specification-build spec1)
-               (specification-build spec2))
-       (= (specification-priority spec1)
-          (specification-priority spec2))
-       (= (specification-period spec1)
-          (specification-period spec2))
-       (equal? (specification-systems spec1)
-               (specification-systems spec2))
-       (equal? (map channel-name
-                    (specification-channels spec1))
-               (map channel-name
-                    (specification-channels spec2)))
-       (equal? (map channel-url
-                    (specification-channels spec1))
-               (map channel-url
-                    (specification-channels spec2)))
-       (equal? (map channel-branch
-                    (specification-channels spec1))
-               (map channel-branch
-                    (specification-channels spec2)))))
-
 (test-assert "default-json"
   (specifications-equal?
    (let ((event (json->gitlab-event default-mr-json)))

base-commit: e96f0887923d4d1cd4e35073fcffdb978d7e1e10
-- 
2.46.0





  parent reply	other threads:[~2024-12-12 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 16:01 [bug#74769] [PATCH Cuirass 0/4] Forgejo event support Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 1/4] tests: Move procedure definition Romain GARBAGE
2024-12-10 16:09   ` [bug#74769] [PATCH Cuirass 2/4] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 13:34     ` Ludovic Courtès
2024-12-10 16:09   ` [bug#74769] [PATCH Cuirass 3/4] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-10 16:09   ` [bug#74769] [PATCH Cuirass 4/4] http: Add admin/forgejo/event Romain GARBAGE
2024-12-12 15:57 ` Romain GARBAGE [this message]
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 2/7] tests: Rename specifications-equal? procedure Romain GARBAGE
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 3/7] forges: Add module for common forges utilities Romain GARBAGE
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 4/7] forges: Define default values for specifications Romain GARBAGE
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 5/7] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 6/7] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-12 15:57   ` [bug#74769] [PATCH Cuirass v2 7/7] http: Add admin/forgejo/event Romain GARBAGE
2024-12-13 10:17   ` bug#74769: [PATCH Cuirass v2 1/7] tests: Move procedure definition 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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20241212155845.27344-1-romain.garbage@inria.fr \
    --to=romain.garbage@inria.fr \
    --cc=74769@debbugs.gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).