[bug#74769,Cuirass,1/4] tests: Move procedure definition.
Commit Message
* 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(-)
base-commit: e96f0887923d4d1cd4e35073fcffdb978d7e1e10
@@ -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)))))
@@ -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)))