summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-03-15 15:17:04 +0100
committerLudovic Courtès <ludo@gnu.org>2022-03-16 15:48:51 +0100
commite3801126a9566bc89c3746a54128609ad6eff1fd (patch)
tree9de2562fe498590360461df89fc951db992e9d19 /tests
parent66a4a5ecb23832cde158b3f71cb941a830b66eef (diff)
downloadguix-e3801126a9566bc89c3746a54128609ad6eff1fd.tar.gz
tests: Exercise 'modify-inputs' with a 'replace' clause.
* tests/packages.scm ("modify-inputs, replace")
("modify-inputs, replace, change output"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 02bdba5f98..2cb90d3145 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1956,6 +1956,32 @@
    (dummy-package "a"
      (arguments (this-package-native-input "hello")))))
 
+(test-eq "modify-inputs, replace"
+  coreutils
+  ;; Replace an input; notice that the label in unchanged.
+  (let* ((p1 (dummy-package "p"
+               (inputs (list hello))))
+         (p2 (package
+               (inherit p1)
+               (version "1")
+               (inputs (modify-inputs (package-inputs p1)
+                         (replace "hello" coreutils))))))
+    (lookup-package-input p2 "hello")))
+
+(test-eq "modify-inputs, replace, change output"
+  guile-3.0
+  ;; Replace an input and choose a different output.
+  (let* ((p1 (dummy-package "p"
+               (inputs (list `(,coreutils "debug")))))
+         (p2 (package
+               (inherit p1)
+               (version "1")
+               (inputs (modify-inputs (package-inputs p1)
+                         (replace "coreutils" `(,guile-3.0 "out")))))))
+    (match (package-inputs p2)
+      ((("coreutils" input "out"))
+       input))))
+
 (test-end "packages")
 
 ;;; Local Variables: