mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 21:59:08 -05:00
import: opam: Adjust test to latest 'opam->guix-package' changes.
This is a followup to a8dccd4bdc
, which
broke the test.
* guix/import/opam.scm (get-opam-repository): Prevent inlining.
* tests/opam.scm ("opam->guix-package"): Mock 'get-opam-repository'.
This commit is contained in:
parent
bfe4cdf88e
commit
799f066768
2 changed files with 38 additions and 32 deletions
|
@ -141,6 +141,9 @@ (define* (get-opam-repository #:optional repo)
|
|||
(string-append location "/" (substring (symbol->string repo) 4)))
|
||||
(else location)))))
|
||||
|
||||
;; Prevent Guile 3 from inlining this procedure so we can mock it in tests.
|
||||
(set! get-opam-repository get-opam-repository)
|
||||
|
||||
(define (latest-version versions)
|
||||
"Find the most recent version from a list of versions."
|
||||
(fold (lambda (a b) (if (version>? a b) a b)) (car versions) versions))
|
||||
|
|
|
@ -80,7 +80,10 @@ (define test-repo
|
|||
(set! test-source-hash
|
||||
(call-with-input-file file-name port-sha256))))
|
||||
(_ (error "Unexpected URL: " url)))))
|
||||
(let ((my-package (string-append test-repo "/packages/foo/foo.1.0.0")))
|
||||
(mock ((guix import opam) get-opam-repository
|
||||
(const test-repo))
|
||||
(let ((my-package (string-append test-repo
|
||||
"/packages/foo/foo.1.0.0")))
|
||||
(mkdir-p my-package)
|
||||
(with-output-to-file (string-append my-package "/opam")
|
||||
(lambda _
|
||||
|
@ -111,7 +114,7 @@ (define test-repo
|
|||
test-source-hash)
|
||||
hash))
|
||||
(x
|
||||
(pk 'fail x #f)))))
|
||||
(pk 'fail x #f))))))
|
||||
|
||||
;; Test the opam file parser
|
||||
;; We fold over some test cases. Each case is a pair of the string to parse and the
|
||||
|
|
Loading…
Reference in a new issue