GNU bug report logs -
#73833
[PATCH] guix: import: composer: Improve composer-fetch.
Previous Next
Full log
Message #16 received at 73833 <at> debbugs.gnu.org (full text, mbox):
* tests/go.scm
(mock-git->origin): Add function.
(go-module->guix-package test): Use mock-git->origin.
---
tests/go.scm | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tests/go.scm b/tests/go.scm
index 8402f3e978..c08a73a850 100644
--- a/tests/go.scm
+++ b/tests/go.scm
@@ -371,6 +371,26 @@ (define (mock-http-get testcase)
(values response-header body)
(error "mocked http-get Unexpected URL: " url)))))
+;; Mock an empty directory by replacing hash.
+(define* (mock-git->origin repo-url ref #:key (ref->commit #f))
+ (let* ((version (if (pair? ref)
+ (cdr ref)
+ #f))
+ (vcommit (match ref->commit
+ (#t commit)
+ (#f version)
+ ((? procedure?) (ref->commit version))
+ (_ #f))))
+ `(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url ,(and (not (eq? repo-url 'null)) repo-url))
+ (commit ,vcommit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5")))))
+
(test-equal "go-module->guix-package"
'(package
(name "go-github-com-go-check-check")
@@ -403,26 +423,7 @@ (define (mock-http-get testcase)
(mock-http-get fixtures-go-check-test))
(mock ((guix http-client) http-fetch
(mock-http-fetch fixtures-go-check-test))
- (mock ((guix import utils) git->origin
- ;; Mock an empty directory by replacing hash.
- (lambda* (repo-url ref #:key (ref->commit #f))
- (let* ((version (if (pair? ref)
- (cdr ref)
- #f))
- (vcommit (match ref->commit
- (#t commit)
- (#f version)
- ((? procedure?) (ref->commit version))
- (_ #f))))
- `(origin
- (method git-fetch)
- (uri (git-reference
- (url ,(and (not (eq? repo-url 'null)) repo-url))
- (commit ,vcommit)))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"))))))
+ (mock ((guix import utils) git->origin mock-git->origin)
(go-module->guix-package* "github.com/go-check/check")))))))
(test-end "go")
--
2.46.0
This bug report was last modified 197 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.