summaryrefslogtreecommitdiff
path: root/tests/upstream.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-05-17 16:58:59 +0200
committerLudovic Courtès <ludo@gnu.org>2023-05-31 23:25:25 +0200
commitcd262c403ff2bbd282cf4734a0819d10ad40845e (patch)
treea79b2bf566f7349e735a63b9d39b5c6a27181488 /tests/upstream.scm
parentec0a2fc87bd651ebc8f253f6369ba4485912d9b2 (diff)
upstream: Remove <upstream-input-change> and related code.
* guix/upstream.scm (<upstream-input-change>): Remove. (changed-inputs): Remove. * tests/upstream.scm (test-package, test-new-package) ("changed-inputs returns no changes") ("changed-inputs returns changes to plain input list") ("changed-inputs returns changes to all plain input lists"): Remove.
Diffstat (limited to 'tests/upstream.scm')
-rw-r--r--tests/upstream.scm120
1 files changed, 0 insertions, 120 deletions
diff --git a/tests/upstream.scm b/tests/upstream.scm
index 0792ebd5d0e..b82579228a8 100644
--- a/tests/upstream.scm
+++ b/tests/upstream.scm
@@ -54,124 +54,4 @@
54 (signature-urls 54 (signature-urls
55 '("ftp://example.org/foo-1.tar.xz.sig")))))) 55 '("ftp://example.org/foo-1.tar.xz.sig"))))))
56 56
57(define test-package
58 (package
59 (name "test")
60 (version "2.10")
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/hello/hello-" version
64 ".tar.gz"))
65 (sha256
66 (base32
67 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
68 (build-system gnu-build-system)
69 (inputs
70 `(("hello" ,hello)))
71 (native-inputs
72 `(("sed" ,sed)
73 ("tar" ,tar)))
74 (propagated-inputs
75 `(("grep" ,grep)))
76 (home-page "http://localhost")
77 (synopsis "test")
78 (description "test")
79 (license license:gpl3+)))
80
81(test-equal "changed-inputs returns no changes"
82 '()
83 (changed-inputs test-package
84 (upstream-source
85 (package "test")
86 (version "1")
87 (urls '())
88 (inputs
89 (let ((->input
90 (lambda (type)
91 (match-lambda
92 ((label _)
93 (upstream-input
94 (name label)
95 (downstream-name label)
96 (type type)))))))
97 (append (map (->input 'regular)
98 (package-inputs test-package))
99 (map (->input 'native)
100 (package-native-inputs test-package))
101 (map (->input 'propagated)
102 (package-propagated-inputs
103 test-package))))))))
104
105(define test-new-package
106 (package
107 (inherit test-package)
108 (inputs
109 (list hello))
110 (native-inputs
111 (list sed tar))
112 (propagated-inputs
113 (list grep))))
114
115(test-assert "changed-inputs returns changes to plain input list"
116 (let ((changes (changed-inputs
117 (package
118 (inherit test-new-package)
119 (inputs (list hello sed))
120 (native-inputs '())
121 (propagated-inputs '()))
122 (upstream-source
123 (package "test")
124 (version "1")
125 (urls '())
126 (inputs (list (upstream-input
127 (name "hello")
128 (downstream-name name))))))))
129 (match changes
130 ;; Exactly one change
131 (((? upstream-input-change? item))
132 (and (equal? (upstream-input-change-type item)
133 'regular)
134 (equal? (upstream-input-change-action item)
135 'remove)
136 (string=? (upstream-input-change-name item)
137 "sed")))
138 (else (pk else #false)))))
139
140(test-assert "changed-inputs returns changes to all plain input lists"
141 (let ((changes (changed-inputs
142 (package
143 (inherit test-new-package)
144 (inputs '())
145 (native-inputs '())
146 (propagated-inputs '()))
147 (upstream-source
148 (package "test")
149 (version "1")
150 (urls '())
151 (inputs (list (upstream-input
152 (name "hello")
153 (downstream-name name)
154 (type 'regular))
155 (upstream-input
156 (name "sed")
157 (downstream-name name)
158 (type 'native))
159 (upstream-input
160 (name "tar")
161 (downstream-name name)
162 (type 'native))
163 (upstream-input
164 (name "grep")
165 (downstream-name name)
166 (type 'propagated))))))))
167 (match changes
168 (((? upstream-input-change? items) ...)
169 (and (equal? (map upstream-input-change-type items)
170 '(regular native native propagated))
171 (equal? (map upstream-input-change-action items)
172 '(add add add add))
173 (equal? (map upstream-input-change-name items)
174 '("hello" "sed" "tar" "grep"))))
175 (else (pk else #false)))))
176
177(test-end) 57(test-end)