1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-28 12:01:49 +02:00

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.
This commit is contained in:
Ludovic Courtès
2023-05-31 23:50:06 +02:00
parent 9f7cd1fcaf
commit 654fcf9971
7 changed files with 278 additions and 284 deletions
+59 -63
View File
@@ -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))))))