[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/138: tests: Add tests for changed-inputs on old-style inputs.
From: |
guix-commits |
Subject: |
01/138: tests: Add tests for changed-inputs on old-style inputs. |
Date: |
Wed, 5 Jan 2022 15:24:37 -0500 (EST) |
rekado pushed a commit to branch master
in repository guix.
commit a6bf1c108ef3b0d63d6d6070b90093bc8f434734
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Tue Jan 4 21:26:29 2022 +0100
tests: Add tests for changed-inputs on old-style inputs.
All these tests pass, because they only test the old-style input alists with
labels.
* tests/upstream.scm ("changed-inputs returns no changes",
"changed-inputs returns changes to labelled input list",
"changed-inputs returns changes to all labelled input lists"): New tests.
---
tests/upstream.scm | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 97 insertions(+), 1 deletion(-)
diff --git a/tests/upstream.scm b/tests/upstream.scm
index e431956960..594334304a 100644
--- a/tests/upstream.scm
+++ b/tests/upstream.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -17,9 +18,16 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (test-upstream)
+ #:use-module (gnu packages base)
+ #:use-module (guix download)
+ #:use-module (guix packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix import print)
+ #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix upstream)
#:use-module (guix tests)
- #:use-module (srfi srfi-64))
+ #:use-module (srfi srfi-64)
+ #:use-module (ice-9 match))
(test-begin "upstream")
@@ -46,4 +54,92 @@
(signature-urls
'("ftp://example.org/foo-1.tar.xz.sig"))))))
+(define test-package
+ (package
+ (name "test")
+ (version "2.10")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/hello/hello-" version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("hello" ,hello)))
+ (native-inputs
+ `(("sed" ,sed)
+ ("tar" ,tar)))
+ (propagated-inputs
+ `(("grep" ,grep)))
+ (home-page "http://localhost")
+ (synopsis "test")
+ (description "test")
+ (license license:gpl3+)))
+
+(define test-package-sexp
+ '(package
+ (name "test")
+ (version "2.10")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/hello/hello-" version
+ ".tar.gz"))
+ (sha256
+ (base32
+ "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("hello" ,hello)))
+ (native-inputs
+ `(("sed" ,sed)
+ ("tar" ,tar)))
+ (propagated-inputs
+ `(("grep" ,grep)))
+ (home-page "http://localhost")
+ (synopsis "test")
+ (description "test")
+ (license license:gpl3+)))
+
+(test-equal "changed-inputs returns no changes"
+ '()
+ (changed-inputs test-package test-package-sexp))
+
+(test-assert "changed-inputs returns changes to labelled input list"
+ (let ((changes (changed-inputs
+ (package
+ (inherit test-package)
+ (inputs `(("hello" ,hello)
+ ("sed" ,sed))))
+ test-package-sexp)))
+ (match changes
+ ;; Exactly one change
+ (((? upstream-input-change? item))
+ (and (equal? (upstream-input-change-type item)
+ 'regular)
+ (equal? (upstream-input-change-action item)
+ 'remove)
+ (string=? (upstream-input-change-name item)
+ "sed")))
+ (else (pk else #false)))))
+
+(test-assert "changed-inputs returns changes to all labelled input lists"
+ (let ((changes (changed-inputs
+ (package
+ (inherit test-package)
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '()))
+ test-package-sexp)))
+ (match changes
+ (((? upstream-input-change? items) ...)
+ (and (equal? (map upstream-input-change-type items)
+ '(regular native native propagated))
+ (equal? (map upstream-input-change-action items)
+ '(add add add add))
+ (equal? (map upstream-input-change-name items)
+ '("hello" "sed" "tar" "grep"))))
+ (else (pk else #false)))))
+
(test-end)
- 18/138: gnu: r-shadowtext: Update to 0.1.0., (continued)
- 18/138: gnu: r-shadowtext: Update to 0.1.0., guix-commits, 2022/01/05
- 11/138: gnu: r-httpuv: Update to 1.6.4., guix-commits, 2022/01/05
- 25/138: gnu: r-dimred: Update to 0.2.4., guix-commits, 2022/01/05
- 19/138: gnu: r-ape: Update to 5.6., guix-commits, 2022/01/05
- 23/138: gnu: r-suppdists: Update to 1.1-9.7., guix-commits, 2022/01/05
- 32/138: gnu: r-tinytex: Update to 0.36., guix-commits, 2022/01/05
- 30/138: gnu: r-venndiagram: Update to 1.7.1., guix-commits, 2022/01/05
- 36/138: gnu: r-dtplyr: Update to 1.2.0., guix-commits, 2022/01/05
- 37/138: gnu: r-renv: Update to 0.15.0., guix-commits, 2022/01/05
- 53/138: gnu: r-ncdf4: Update to 1.19., guix-commits, 2022/01/05
- 01/138: tests: Add tests for changed-inputs on old-style inputs.,
guix-commits <=
- 05/138: gnu: r-openssl: Use openssl instead of libressl., guix-commits, 2022/01/05
- 12/138: gnu: r-brio: Update to 1.1.3., guix-commits, 2022/01/05
- 08/138: gnu: r-activedriverwgs: Update to 1.0.3., guix-commits, 2022/01/05
- 09/138: gnu: Add r-matrixextra., guix-commits, 2022/01/05
- 02/138: tests: Add failing tests for changed-inputs on new style inputs., guix-commits, 2022/01/05
- 16/138: gnu: r-ggpp: Update to 0.4.3., guix-commits, 2022/01/05
- 21/138: gnu: r-pkgbuild: Update to 1.3.1., guix-commits, 2022/01/05
- 20/138: gnu: r-glue: Update to 1.6.0., guix-commits, 2022/01/05
- 29/138: gnu: r-hardyweinberg: Update to 1.7.4., guix-commits, 2022/01/05
- 35/138: gnu: r-openxlsx: Update to 4.2.5., guix-commits, 2022/01/05