aboutsummaryrefslogtreecommitdiff
path: root/tests/cpan.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-15 18:05:26 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-15 18:40:43 +0100
commit69f132554c6bd23df4610a21e636bde5f0578174 (patch)
treefe4b52249804ad3df10b724177eb5df3b8a81677 /tests/cpan.scm
parentea6d962b93a38dd11c1d43c647a7ac10c2f75fe8 (diff)
downloadguix-69f132554c6bd23df4610a21e636bde5f0578174.tar
guix-69f132554c6bd23df4610a21e636bde5f0578174.tar.gz
import: cpan: Rewrite to use 'define-json-mapping'.
* guix/import/cpan.scm (<cpan-dependency>, <cpan-release>): New JSON-mapped record types. (metacpan-url->mirror-url): New procedure. (cpan-source-url): Rewrite in terms of it. (cpan-version): Remove. (cpan-module->sexp): Rewrite to take a <cpan-release> instead of an alist, and rename 'meta' to 'release'. [convert-inputs]: Rewrite to use 'cpan-release-dependencies'. Update calls to 'convert-inputs' to pass a list of symbols. Replace 'assoc-ref' calls with the appropriate field accessors. (cpan->guix-package): Rename 'module-meta' to 'release'. (latest-release): Likewise, and use the appropriate accessors. * tests/cpan.scm (test-json): Remove "prereqs" record; add "dependency" list. ("source-url-http", "source-url-https"): Remove. ("metacpan-url->mirror-url, http") ("metacpan-url->mirror-url, https"): New tests.
Diffstat (limited to 'tests/cpan.scm')
-rw-r--r--tests/cpan.scm33
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/cpan.scm b/tests/cpan.scm
index 189dd027e6..043d401032 100644
--- a/tests/cpan.scm
+++ b/tests/cpan.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Alex Sassmannshausen <alex@pompo.co>
+;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,13 +33,6 @@
(define test-json
"{
\"metadata\" : {
- \"prereqs\" : {
- \"runtime\" : {
- \"requires\" : {
- \"Test::Script\" : \"1.05\",
- }
- }
- }
\"name\" : \"Foo-Bar\",
\"version\" : \"0.1\"
}
@@ -47,6 +41,13 @@
\"license\" : [
\"perl_5\"
],
+ \"dependency\": [
+ { \"relationship\": \"requires\",
+ \"phase\": \"runtime\",
+ \"version\": \"1.05\",
+ \"module\": \"Test::Script\"
+ }
+ ],
\"abstract\" : \"Fizzle Fuzz\",
\"download_url\" : \"http://example.com/Foo-Bar-0.1.tar.gz\",
\"author\" : \"Guix\",
@@ -107,16 +108,14 @@
(x
(pk 'fail x #f))))))
-(test-equal "source-url-http"
- ((@@ (guix import cpan) cpan-source-url)
- `(("download_url" .
- "http://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")))
- "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+(test-equal "metacpan-url->mirror-url, http"
+ "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"
+ (metacpan-url->mirror-url
+ "http://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"))
-(test-equal "source-url-https"
- ((@@ (guix import cpan) cpan-source-url)
- `(("download_url" .
- "https://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")))
- "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz")
+(test-equal "metacpan-url->mirror-url, https"
+ "mirror://cpan/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"
+ (metacpan-url->mirror-url
+ "https://cpan.metacpan.org/authors/id/T/TE/TEST/Foo-Bar-0.1.tar.gz"))
(test-end "cpan")