guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Fri, 13 Dec 2024 04:32:32 -0500 (EST)

branch: main
commit b9abd222cd70fbebafca39522d891df20c4a7671
Author: Romain GARBAGE <romain.garbage@inria.fr>
AuthorDate: Thu Dec 12 16:57:49 2024 +0100

    tests: Move procedure definition.
    
    * tests/common.scm (specifications-equal?): New variable.
    * tests/gitlab.scm (specifications-equal?): Remove variable.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]