diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-05-31 23:50:06 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-05-31 23:50:06 +0200 |
commit | 654fcf9971bb01389d577be07c6ec0f68940c743 (patch) | |
tree | 59ff22f02c9b265adc4b8f596b9924b586895248 | |
parent | 9f7cd1fcaf99c8e8430d0b29335220701664dc54 (diff) | |
download | guix-654fcf9971bb01389d577be07c6ec0f68940c743.tar.gz |
tests: Use quasiquoted 'match' patterns for package sexps.
Turns out it's easier to read. * tests/cpan.scm ("cpan->guix-package"): Use a quasiquoted pattern. * tests/elpa.scm (eval-test-with-elpa): Likewise. * tests/gem.scm ("gem->guix-package") ("gem->guix-package with a specific version") ("gem-recursive-import") ("gem-recursive-import with a specific version"): Likewise. * tests/hexpm.scm ("hexpm-recursive-import"): Likewise. * tests/opam.scm ("opam->guix-package"): Likewise. * tests/pypi.scm ("pypi->guix-package, no wheel") ("pypi->guix-package, wheels") ("pypi->guix-package, no usable requirement file.") ("pypi->guix-package, package name contains \"-\" followed by digits"): Likewise. * tests/texlive.scm ("texlive->guix-package"): Likewise.
-rw-r--r-- | tests/cpan.scm | 31 | ||||
-rw-r--r-- | tests/elpa.scm | 28 | ||||
-rw-r--r-- | tests/gem.scm | 184 | ||||
-rw-r--r-- | tests/hexpm.scm | 126 | ||||
-rw-r--r-- | tests/opam.scm | 33 | ||||
-rw-r--r-- | tests/pypi.scm | 122 | ||||
-rw-r--r-- | tests/texlive.scm | 38 |
7 files changed, 278 insertions, 284 deletions
diff --git a/tests/cpan.scm b/tests/cpan.scm index 5fcce85d8d..e4ee788e9d 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -73,22 +73,21 @@ (parameterize ((%metacpan-base-url (%local-url)) (current-http-proxy (%local-url))) (match (cpan->guix-package "Foo::Bar") - (('package - ('name "perl-foo-bar") - ('version "0.1") - ('source ('origin - ('method 'url-fetch) - ('uri ('string-append "http://example.com/Foo-Bar-" - 'version ".tar.gz")) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'perl-build-system) - ('propagated-inputs ('list 'perl-test-script)) - ('home-page "https://metacpan.org/release/Foo-Bar") - ('synopsis "Fizzle Fuzz") - ('description 'fill-in-yourself!) - ('license 'perl-license)) + (`(package + (name "perl-foo-bar") + (version "0.1") + (source (origin + (method url-fetch) + (uri (string-append "http://example.com/Foo-Bar-" + version ".tar.gz")) + (sha256 + (base32 ,(? string? hash))))) + (build-system perl-build-system) + (propagated-inputs (list perl-test-script)) + (home-page "https://metacpan.org/release/Foo-Bar") + (synopsis "Fizzle Fuzz") + (description fill-in-yourself!) + (license perl-license)) (string=? (bytevector->nix-base32-string (call-with-input-string test-source port-sha256)) hash)) diff --git a/tests/elpa.scm b/tests/elpa.scm index 56008fe014..f6d008cd09 100644 --- a/tests/elpa.scm +++ b/tests/elpa.scm @@ -66,20 +66,20 @@ (200 "fake tarball contents")) (parameterize ((current-http-proxy (%local-url))) (match (elpa->guix-package pkg #:repo 'gnu/http) - (('package - ('name "emacs-auctex") - ('version "11.88.6") - ('source - ('origin - ('method 'url-fetch) - ('uri ('string-append - "http://elpa.gnu.org/packages/auctex-" 'version ".tar")) - ('sha256 ('base32 (? string? hash))))) - ('build-system 'emacs-build-system) - ('home-page "http://www.gnu.org/software/auctex/") - ('synopsis "Integrated environment for *TeX*") - ('description "This is the description.") - ('license 'license:gpl3+)) + (`(package + (name "emacs-auctex") + (version "11.88.6") + (source + (origin + (method url-fetch) + (uri (string-append + "http://elpa.gnu.org/packages/auctex-" version ".tar")) + (sha256 (base32 ,(? string? hash))))) + (build-system emacs-build-system) + (home-page "http://www.gnu.org/software/auctex/") + (synopsis "Integrated environment for *TeX*") + (description "This is the description.") + (license license:gpl3+)) #t) (x (pk 'fail x #f)))))) diff --git a/tests/gem.scm b/tests/gem.scm index a2b5e39077..7e2436e3fb 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -105,21 +105,21 @@ (string-length test-foo-json))) (_ (error "Unexpected URL: " url))))) (match (gem->guix-package "foo") - (('package - ('name "ruby-foo") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "foo" 'version)) - ('sha256 - ('base32 + (`(package + (name "ruby-foo") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (rubygems-uri "foo" version)) + (sha256 + (base32 "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler 'ruby-bar)) - ('synopsis "A cool gem") - ('description "This package provides a cool gem") - ('home-page "https://example.com") - ('license ('list 'license:expat 'license:asl2.0))) + (build-system ruby-build-system) + (propagated-inputs (list bundler ruby-bar)) + (synopsis "A cool gem") + (description "This package provides a cool gem") + (home-page "https://example.com") + (license (list license:expat license:asl2.0))) #t) (x (pk 'fail x #f))))) @@ -134,21 +134,21 @@ (string-length test-foo-v2-json))) (_ (error "Unexpected URL: " url))))) (match (gem->guix-package "foo" #:version "2.0.0") - (('package - ('name "ruby-foo") - ('version "2.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "foo" 'version)) - ('sha256 - ('base32 + (`(package + (name "ruby-foo") + (version "2.0.0") + (source (origin + (method url-fetch) + (uri (rubygems-uri "foo" version)) + (sha256 + (base32 "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler 'ruby-bar)) - ('synopsis "A cool gem") - ('description "This package provides a cool gem") - ('home-page "https://example.com") - ('license ('list 'license:expat 'license:asl2.0))) + (build-system ruby-build-system) + (propagated-inputs (list bundler ruby-bar)) + (synopsis "A cool gem") + (description "This package provides a cool gem") + (home-page "https://example.com") + (license (list license:expat license:asl2.0))) #t) (x (pk 'fail x #f))))) @@ -169,38 +169,38 @@ (string-length test-bundler-json))) (_ (error "Unexpected URL: " url))))) (match (gem-recursive-import "foo") - ((('package - ('name "ruby-bar") - ('version "1.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "bar" 'version)) - ('sha256 - ('base32 - "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler)) - ('synopsis "Another cool gem") - ('description "Another cool gem") - ('home-page "https://example.com") - ('license #f)) ;no licensing info - ('package - ('name "ruby-foo") - ('version "1.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "foo" 'version)) - ('sha256 - ('base32 - "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler 'ruby-bar)) - ('synopsis "A cool gem") - ('description "This package provides a cool gem") - ('home-page "https://example.com") - ('license ('list 'license:expat 'license:asl2.0)))) + (`((package + (name "ruby-bar") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (rubygems-uri "bar" version)) + (sha256 + (base32 + "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) + (build-system ruby-build-system) + (propagated-inputs (list bundler)) + (synopsis "Another cool gem") + (description "Another cool gem") + (home-page "https://example.com") + (license #f)) ;no licensing info + (package + (name "ruby-foo") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (rubygems-uri "foo" version)) + (sha256 + (base32 + "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) + (build-system ruby-build-system) + (propagated-inputs (list bundler ruby-bar)) + (synopsis "A cool gem") + (description "This package provides a cool gem") + (home-page "https://example.com") + (license (list license:expat license:asl2.0)))) #t) (x (pk 'fail x #f))))) @@ -221,38 +221,38 @@ (string-length test-bundler-json))) (_ (error "Unexpected URL: " url))))) (match (gem-recursive-import "foo" "2.0.0") - ((('package - ('name "ruby-bar") - ('version "1.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "bar" 'version)) - ('sha256 - ('base32 - "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler)) - ('synopsis "Another cool gem") - ('description "Another cool gem") - ('home-page "https://example.com") - ('license #f)) ;no licensing info - ('package - ('name "ruby-foo") - ('version "2.0.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('rubygems-uri "foo" 'version)) - ('sha256 - ('base32 - "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) - ('build-system 'ruby-build-system) - ('propagated-inputs ('list 'bundler 'ruby-bar)) - ('synopsis "A cool gem") - ('description "This package provides a cool gem") - ('home-page "https://example.com") - ('license ('list 'license:expat 'license:asl2.0)))) + (`((package + (name "ruby-bar") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (rubygems-uri "bar" version)) + (sha256 + (base32 + "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) + (build-system ruby-build-system) + (propagated-inputs (list bundler)) + (synopsis "Another cool gem") + (description "Another cool gem") + (home-page "https://example.com") + (license #f)) ;no licensing info + (package + (name "ruby-foo") + (version "2.0.0") + (source + (origin + (method url-fetch) + (uri (rubygems-uri "foo" version)) + (sha256 + (base32 + "1a270mlajhrmpqbhxcqjqypnvgrq4pgixpv3w9gwp1wrrapnwrzk")))) + (build-system ruby-build-system) + (propagated-inputs (list bundler ruby-bar)) + (synopsis "A cool gem") + (description "This package provides a cool gem") + (home-page "https://example.com") + (license (list license:expat license:asl2.0)))) #t) (x (pk 'fail x #f))))) diff --git a/tests/hexpm.scm b/tests/hexpm.scm index e9f899f166..5df9af0ca6 100644 --- a/tests/hexpm.scm +++ b/tests/hexpm.scm @@ -139,22 +139,22 @@ "source") (_ (error "url-fetch got unexpected URL: " url)))))))) (match (hexpm->guix-package "bla") - (('package - ('name "erlang-bla") - ('version "1.5.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('hexpm-uri "bla" 'version)) - ('sha256 - ('base32 - "0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1")))) - ('build-system 'rebar-build-system) - ('inputs ('list 'erlang-blubb 'erlang-fasel)) - ('synopsis "A cool package") - ('description "This package provides a cool package") - ('home-page "https://hex.pm/packages/bla") - ('license ('list 'license:expat 'license:asl2.0))) + (`(package + (name "erlang-bla") + (version "1.5.0") + (source + (origin + (method url-fetch) + (uri (hexpm-uri "bla" version)) + (sha256 + (base32 + "0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1")))) + (build-system rebar-build-system) + (inputs (list erlang-blubb erlang-fasel)) + (synopsis "A cool package") + (description "This package provides a cool package") + (home-page "https://hex.pm/packages/bla") + (license (list license:expat license:asl2.0))) #t) (x (pk 'fail x #f)))))) @@ -199,53 +199,53 @@ "fasel-source") (_ (error "url-fetch got unexpected URL: " url)))))))) (match (hexpm-recursive-import "bla") - ((('package - ('name "erlang-blubb") - ('version "0.3.1") - ('source - ('origin - ('method 'url-fetch) - ('uri ('hexpm-uri "blubb" 'version)) - ('sha256 - ('base32 - "17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2")))) - ('build-system 'mix-build-system) - ('inputs ('list 'erlang-fasel)) - ('synopsis "Another cool package") - ('description "Another cool package") - ('home-page "https://hex.pm/packages/blubb") - ('license 'license:expat)) - ('package - ('name "erlang-fasel") - ('version "1.2.1") - ('source - ('origin - ('method 'url-fetch) - ('uri ('hexpm-uri "fasel" 'version)) - ('sha256 - ('base32 - "1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha")))) - ('build-system 'gnu-build-system) - ('synopsis "Yet another cool package") - ('description "Yet another cool package") - ('home-page "https://hex.pm/packages/fasel") - ('license "GPL")) - ('package - ('name "erlang-bla") - ('version "1.5.0") - ('source - ('origin - ('method 'url-fetch) - ('uri ('hexpm-uri "bla" 'version)) - ('sha256 - ('base32 - "0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8")))) - ('build-system 'rebar-build-system) - ('inputs ('list 'erlang-blubb 'erlang-fasel)) - ('synopsis "A cool package") - ('description "This package provides a cool package") - ('home-page "https://hex.pm/packages/bla") - ('license ('list 'license:expat 'license:asl2.0)))) + (`((package + (name "erlang-blubb") + (version "0.3.1") + (source + (origin + (method url-fetch) + (uri (hexpm-uri "blubb" version)) + (sha256 + (base32 + "17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2")))) + (build-system mix-build-system) + (inputs (list erlang-fasel)) + (synopsis "Another cool package") + (description "Another cool package") + (home-page "https://hex.pm/packages/blubb") + (license license:expat)) + (package + (name "erlang-fasel") + (version "1.2.1") + (source + (origin + (method url-fetch) + (uri (hexpm-uri "fasel" version)) + (sha256 + (base32 + "1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha")))) + (build-system gnu-build-system) + (synopsis "Yet another cool package") + (description "Yet another cool package") + (home-page "https://hex.pm/packages/fasel") + (license "GPL")) + (package + (name "erlang-bla") + (version "1.5.0") + (source + (origin + (method url-fetch) + (uri (hexpm-uri "bla" version)) + (sha256 + (base32 + "0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8")))) + (build-system rebar-build-system) + (inputs (list erlang-blubb erlang-fasel)) + (synopsis "A cool package") + (description "This package provides a cool package") + (home-page "https://hex.pm/packages/bla") + (license (list license:expat license:asl2.0)))) #t) (x (pk 'fail x #f)))))) diff --git a/tests/opam.scm b/tests/opam.scm index b5f02f809b..832fea1d9b 100644 --- a/tests/opam.scm +++ b/tests/opam.scm @@ -92,23 +92,22 @@ url { (lambda _ (format #t "~a" test-opam-file)))) (match (opam->guix-package "foo" #:repo (list test-repo)) - (('package - ('name "ocaml-foo") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri "https://example.org/foo-1.0.0.tar.gz") - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'ocaml-build-system) - ('propagated-inputs ('list 'ocaml-zarith)) - ('native-inputs - ('list 'ocaml-alcotest 'ocamlbuild)) - ('home-page "https://example.org/") - ('synopsis "Some example package") - ('description "This package is just an example.") - ('license 'license:bsd-3)) + (`(package + (name "ocaml-foo") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri "https://example.org/foo-1.0.0.tar.gz") + (sha256 + (base32 ,(? string? hash))))) + (build-system ocaml-build-system) + (propagated-inputs (list ocaml-zarith)) + (native-inputs + (list ocaml-alcotest ocamlbuild)) + (home-page "https://example.org/") + (synopsis "Some example package") + (description "This package is just an example.") + (license license:bsd-3)) (string=? (bytevector->nix-base32-string test-source-hash) hash)) diff --git a/tests/pypi.scm b/tests/pypi.scm index f3b2771f4b..42b39cde73 100644 --- a/tests/pypi.scm +++ b/tests/pypi.scm @@ -302,22 +302,21 @@ files specified by SPECS. Return its file name." ("/foo/json" 200 ,(lambda (port) (display (foo-json) port))))) (match (pypi->guix-package "foo") - (('package - ('name "python-foo") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('pypi-uri "foo" 'version)) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'pyproject-build-system) - ('propagated-inputs ('list 'python-bar 'python-foo)) - ('native-inputs ('list 'python-pytest)) - ('home-page "http://example.com") - ('synopsis "summary") - ('description "summary") - ('license 'license:lgpl2.0)) + (`(package + (name "python-foo") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "foo" version)) + (sha256 + (base32 ,(? string? hash))))) + (build-system pyproject-build-system) + (propagated-inputs (list python-bar python-foo)) + (native-inputs (list python-pytest)) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license license:lgpl2.0)) (and (string=? default-sha256/base32 hash) (equal? (pypi->guix-package "foo" #:version "1.0.0") (pypi->guix-package "foo")) @@ -344,22 +343,21 @@ to make sure we're testing wheels")))) ;; computed in the previous test. (invalidate-memoization! pypi->guix-package) (match (pypi->guix-package "foo") - (('package - ('name "python-foo") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('pypi-uri "foo" 'version)) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'pyproject-build-system) - ('propagated-inputs ('list 'python-bar 'python-baz)) - ('native-inputs ('list 'python-pytest)) - ('home-page "http://example.com") - ('synopsis "summary") - ('description "summary") - ('license 'license:lgpl2.0)) + (`(package + (name "python-foo") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "foo" version)) + (sha256 + (base32 ,(? string? hash))))) + (build-system pyproject-build-system) + (propagated-inputs (list python-bar python-baz)) + (native-inputs (list python-pytest)) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license license:lgpl2.0)) (string=? default-sha256/base32 hash)) (x (pk 'fail x #f)))))) @@ -375,20 +373,19 @@ to make sure we're testing wheels")))) ;; value computed in the previous test. (invalidate-memoization! pypi->guix-package) (match (pypi->guix-package "foo") - (('package - ('name "python-foo") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('pypi-uri "foo" 'version)) - ('sha256 - ('base32 - (? string? hash))))) - ('build-system 'pyproject-build-system) - ('home-page "http://example.com") - ('synopsis "summary") - ('description "summary") - ('license 'license:lgpl2.0)) + (`(package + (name "python-foo") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "foo" version)) + (sha256 + (base32 ,(? string? hash))))) + (build-system pyproject-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license license:lgpl2.0)) (string=? default-sha256/base32 hash)) (x (pk 'fail x #f)))))) @@ -403,23 +400,22 @@ to make sure we're testing wheels")))) (display (foo-json #:name "foo-99") port)))) (match (pypi->guix-package "foo-99") - (('package - ('name "python-foo-99") - ('version "1.0.0") - ('source ('origin - ('method 'url-fetch) - ('uri ('pypi-uri "foo-99" 'version)) - ('sha256 - ('base32 - (? string? hash))))) - ('properties ('quote (("upstream-name" . "foo-99")))) - ('build-system 'pyproject-build-system) - ('propagated-inputs ('list 'python-bar 'python-foo)) - ('native-inputs ('list 'python-pytest)) - ('home-page "http://example.com") - ('synopsis "summary") - ('description "summary") - ('license 'license:lgpl2.0)) + (`(package + (name "python-foo-99") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "foo-99" version)) + (sha256 + (base32 ,(? string? hash))))) + (properties (quote (("upstream-name" . "foo-99")))) + (build-system pyproject-build-system) + (propagated-inputs (list python-bar python-foo)) + (native-inputs (list python-pytest)) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license license:lgpl2.0)) (string=? default-sha256/base32 hash)) (x (pk 'fail x #f)))))) diff --git a/tests/texlive.scm b/tests/texlive.scm index c3631861ce..7d7ad332b4 100644 --- a/tests/texlive.scm +++ b/tests/texlive.scm @@ -174,27 +174,27 @@ completely compatible with Plain TeX.") #:package-database (lambda _ %fake-tlpdb)))) (match result - (('package - ('inherit ('simple-texlive-package + (`(package + (inherit (simple-texlive-package "texlive-texsis" - ('list "bibtex/bst/texsis/" - "doc/man/man1/" - "doc/otherformats/texsis/base/" - "tex/texsis/base/" - "tex/texsis/config/") - ('base32 (? string? hash)) + (list "bibtex/bst/texsis/" + "doc/man/man1/" + "doc/otherformats/texsis/base/" + "tex/texsis/base/" + "tex/texsis/config/") + (base32 ,(? string? hash)) #:trivial? #t)) - ('version . any) - ('propagated-inputs - ('list 'texlive-cm - 'texlive-hyphen-base - 'texlive-knuth-lib - 'texlive-plain - 'texlive-tex)) - ('home-page (? string?)) - ('synopsis (? string?)) - ('description (? string?)) - ('license 'lppl)) + (version ,_) + (propagated-inputs + (list texlive-cm + texlive-hyphen-base + texlive-knuth-lib + texlive-plain + texlive-tex)) + (home-page ,(? string?)) + (synopsis ,(? string?)) + (description ,(? string?)) + (license lppl)) #true) (_ (begin |