diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2026-04-02 18:23:28 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-04-24 22:57:49 +0200 |
| commit | fbd8568c22df88321cf7ab4ce8e233fcb311737e (patch) | |
| tree | b05bd7bf1a26400d5c5a34daeeecbcdd57290dc8 /tests/style.scm | |
| parent | 31c2fc709b932594007b344ba519d3f2f8ecc8de (diff) | |
tests: style: Fix tests for guile > 3.0.9.
* tests/style.scm : Drop the snippet that skipped all tests.
(read-package-field): Return S-expressions with comments rather than a
string.
Rewrite all tests accordingly.
Change-Id: I478611e7c58747a1b80598366c2b5510d9625498
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #7632
Diffstat (limited to 'tests/style.scm')
| -rw-r--r-- | tests/style.scm | 240 |
1 files changed, 108 insertions, 132 deletions
diff --git a/tests/style.scm b/tests/style.scm index 350feed22b0..17cc9507f78 100644 --- a/tests/style.scm +++ b/tests/style.scm | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | (define-module (tests-style) | 19 | (define-module (tests-style) |
| 20 | #:use-module ((gcrypt hash) #:select (port-sha256)) | 20 | #:use-module ((gcrypt hash) #:select (port-sha256)) |
| 21 | #:use-module (guix packages) | 21 | #:use-module (guix packages) |
| 22 | #:use-module (guix read-print) | ||
| 22 | #:use-module (guix scripts style) | 23 | #:use-module (guix scripts style) |
| 23 | #:use-module ((guix utils) | 24 | #:use-module ((guix utils) |
| 24 | #:select (guile-version>? | 25 | #:select (guile-version>? |
| @@ -127,25 +128,19 @@ | |||
| 127 | (define* (read-package-field package field #:optional (count 1)) | 128 | (define* (read-package-field package field #:optional (count 1)) |
| 128 | (let* ((location (package-field-location package field)) | 129 | (let* ((location (package-field-location package field)) |
| 129 | (file (location-file location)) | 130 | (file (location-file location)) |
| 130 | (line (location-line location))) | 131 | (line (location-line location)) |
| 131 | (call-with-input-file (if (string-prefix? "/" file) | 132 | (absolute-file (if (string-prefix? "/" file) |
| 132 | file | 133 | file |
| 133 | (string-append (test-directory) "/" | 134 | (string-append (test-directory) "/" |
| 134 | file)) | 135 | file))) |
| 135 | (lambda (port) | 136 | (lines (call-with-input-file absolute-file |
| 136 | (read-lines port line count))))) | 137 | (lambda (port) |
| 138 | (read-lines port line count))))) | ||
| 139 | (call-with-input-string lines read-with-comments/sequence))) | ||
| 137 | 140 | ||
| 138 | 141 | ||
| 139 | (test-begin "style") | 142 | (test-begin "style") |
| 140 | 143 | ||
| 141 | (when (guile-version>? "3.0.9") | ||
| 142 | ;; The output of 'pretty-print' changed in Guile 3.0.10. These tests are | ||
| 143 | ;; currently written against the output of 'pretty-print' from 3.0.9, so | ||
| 144 | ;; skip them when running on a newer version. | ||
| 145 | ;; | ||
| 146 | ;; TODO: Adjust tests for 3.0.10+. | ||
| 147 | (test-skip 1000)) | ||
| 148 | |||
| 149 | (test-equal "nothing to rewrite" | 144 | (test-equal "nothing to rewrite" |
| 150 | '() | 145 | '() |
| 151 | (with-test-package '() | 146 | (with-test-package '() |
| @@ -153,29 +148,21 @@ | |||
| 153 | 148 | ||
| 154 | (test-equal "input labels, mismatch" | 149 | (test-equal "input labels, mismatch" |
| 155 | (list `(("foo" ,gmp) ("bar" ,acl)) | 150 | (list `(("foo" ,gmp) ("bar" ,acl)) |
| 156 | " (inputs `((\"foo\" ,gmp) (\"bar\" ,acl)))\n") | 151 | '((inputs `(("foo" ,gmp) ("bar" ,acl))))) |
| 157 | (with-test-package '((inputs `(("foo" ,gmp) ("bar" ,acl)))) | 152 | (with-test-package '((inputs `(("foo" ,gmp) ("bar" ,acl)))) |
| 158 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) | 153 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) |
| 159 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) | 154 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) |
| 160 | 155 | ||
| 161 | (test-equal "input labels, simple" | 156 | (test-equal "input labels, simple" |
| 162 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 157 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 163 | " (inputs (list gmp acl))\n") | 158 | '((inputs (list gmp acl)))) |
| 164 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) | 159 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) |
| 165 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) | 160 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) |
| 166 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) | 161 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) |
| 167 | 162 | ||
| 168 | (test-equal "input labels, long list with one item per line" | 163 | (test-equal "input labels, long list with one item per line" |
| 169 | (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) | 164 | (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) |
| 170 | "\ | 165 | '((list gmp acl gmp acl gmp acl gmp acl) unbalanced)) |
| 171 | (list gmp | ||
| 172 | acl | ||
| 173 | gmp | ||
| 174 | acl | ||
| 175 | gmp | ||
| 176 | acl | ||
| 177 | gmp | ||
| 178 | acl))\n") | ||
| 179 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) | 166 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) |
| 180 | ("gmp" ,gmp) ("acl" ,acl) | 167 | ("gmp" ,gmp) ("acl" ,acl) |
| 181 | ("gmp" ,gmp) ("acl" ,acl) | 168 | ("gmp" ,gmp) ("acl" ,acl) |
| @@ -184,25 +171,22 @@ | |||
| 184 | (read-package-field (@ (my-packages) my-coreutils) 'inputs 8)))) | 171 | (read-package-field (@ (my-packages) my-coreutils) 'inputs 8)))) |
| 185 | 172 | ||
| 186 | (test-equal "input labels, sdl-union" | 173 | (test-equal "input labels, sdl-union" |
| 187 | "\ | 174 | '((inputs (list gmp acl (sdl-union 1 2 3 4)))) |
| 188 | (list gmp acl | ||
| 189 | (sdl-union 1 2 3 4)))\n" | ||
| 190 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) | 175 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) |
| 191 | ("sdl-union" ,(sdl-union 1 2 3 4))))) | 176 | ("sdl-union" ,(sdl-union 1 2 3 4))))) |
| 192 | (read-package-field (@ (my-packages) my-coreutils) 'inputs 2))) | 177 | (read-package-field (@ (my-packages) my-coreutils) 'inputs 2))) |
| 193 | 178 | ||
| 194 | (test-equal "input labels, output" | 179 | (test-equal "input labels, output" |
| 195 | (list `(("gmp" ,gmp "debug") ("acl" ,acl)) | 180 | (list `(("gmp" ,gmp "debug") ("acl" ,acl)) |
| 196 | " (inputs (list `(,gmp \"debug\") acl))\n") | 181 | '((inputs (list `(,gmp "debug") acl)))) |
| 197 | (with-test-package '((inputs `(("gmp" ,gmp "debug") ("acl" ,acl)))) | 182 | (with-test-package '((inputs `(("gmp" ,gmp "debug") ("acl" ,acl)))) |
| 198 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) | 183 | (list (package-direct-inputs (@ (my-packages) my-coreutils)) |
| 199 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) | 184 | (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) |
| 200 | 185 | ||
| 201 | (test-equal "input labels, prepend" | 186 | (test-equal "input labels, prepend" |
| 202 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 187 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 203 | "\ | 188 | '((modify-inputs (package-propagated-inputs coreutils) |
| 204 | (modify-inputs (package-propagated-inputs coreutils) | 189 | (prepend gmp acl)) unbalanced)) |
| 205 | (prepend gmp acl)))\n") | ||
| 206 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) | 190 | (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) |
| 207 | ,@(package-propagated-inputs coreutils)))) | 191 | ,@(package-propagated-inputs coreutils)))) |
| 208 | (list (package-inputs (@ (my-packages) my-coreutils)) | 192 | (list (package-inputs (@ (my-packages) my-coreutils)) |
| @@ -210,10 +194,9 @@ | |||
| 210 | 194 | ||
| 211 | (test-equal "input labels, prepend + delete" | 195 | (test-equal "input labels, prepend + delete" |
| 212 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 196 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 213 | "\ | 197 | `((modify-inputs (package-propagated-inputs coreutils) |
| 214 | (modify-inputs (package-propagated-inputs coreutils) | 198 | (delete "gmp") |
| 215 | (delete \"gmp\") | 199 | (prepend gmp acl)) unbalanced)) |
| 216 | (prepend gmp acl)))\n") | ||
| 217 | (with-test-package '((inputs `(("gmp" ,gmp) | 200 | (with-test-package '((inputs `(("gmp" ,gmp) |
| 218 | ("acl" ,acl) | 201 | ("acl" ,acl) |
| 219 | ,@(alist-delete "gmp" | 202 | ,@(alist-delete "gmp" |
| @@ -223,10 +206,9 @@ | |||
| 223 | 206 | ||
| 224 | (test-equal "input labels, prepend + delete multiple" | 207 | (test-equal "input labels, prepend + delete multiple" |
| 225 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 208 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 226 | "\ | 209 | '((modify-inputs (package-propagated-inputs coreutils) |
| 227 | (modify-inputs (package-propagated-inputs coreutils) | 210 | (delete "foo" "bar" "baz") |
| 228 | (delete \"foo\" \"bar\" \"baz\") | 211 | (prepend gmp acl)) unbalanced)) |
| 229 | (prepend gmp acl)))\n") | ||
| 230 | (with-test-package '((inputs `(("gmp" ,gmp) | 212 | (with-test-package '((inputs `(("gmp" ,gmp) |
| 231 | ("acl" ,acl) | 213 | ("acl" ,acl) |
| 232 | ,@(fold alist-delete | 214 | ,@(fold alist-delete |
| @@ -237,9 +219,8 @@ | |||
| 237 | 219 | ||
| 238 | (test-equal "input labels, replace" | 220 | (test-equal "input labels, replace" |
| 239 | (list '() ;there's no "gmp" input to replace | 221 | (list '() ;there's no "gmp" input to replace |
| 240 | "\ | 222 | '((modify-inputs (package-propagated-inputs coreutils) |
| 241 | (modify-inputs (package-propagated-inputs coreutils) | 223 | (replace "gmp" gmp)) unbalanced)) |
| 242 | (replace \"gmp\" gmp)))\n") | ||
| 243 | (with-test-package '((inputs `(("gmp" ,gmp) | 224 | (with-test-package '((inputs `(("gmp" ,gmp) |
| 244 | ,@(alist-delete "gmp" | 225 | ,@(alist-delete "gmp" |
| 245 | (package-propagated-inputs coreutils))))) | 226 | (package-propagated-inputs coreutils))))) |
| @@ -248,8 +229,7 @@ | |||
| 248 | 229 | ||
| 249 | (test-equal "input labels, 'safe' policy" | 230 | (test-equal "input labels, 'safe' policy" |
| 250 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 231 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 251 | "\ | 232 | '((inputs (list gmp acl)))) |
| 252 | (inputs (list gmp acl))\n") | ||
| 253 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("ACL" ,acl))) | 233 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("ACL" ,acl))) |
| 254 | (arguments '())) ;no build system arguments | 234 | (arguments '())) ;no build system arguments |
| 255 | (lambda (directory) | 235 | (lambda (directory) |
| @@ -266,8 +246,7 @@ | |||
| 266 | 246 | ||
| 267 | (test-equal "input labels, 'safe' policy, trivial arguments" | 247 | (test-equal "input labels, 'safe' policy, trivial arguments" |
| 268 | (list `(("gmp" ,gmp) ("mpfr" ,mpfr)) | 248 | (list `(("gmp" ,gmp) ("mpfr" ,mpfr)) |
| 269 | "\ | 249 | `((inputs (list gmp mpfr)))) |
| 270 | (inputs (list gmp mpfr))\n") | ||
| 271 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("Mpfr" ,mpfr))) | 250 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("Mpfr" ,mpfr))) |
| 272 | (arguments ;"trivial" arguments | 251 | (arguments ;"trivial" arguments |
| 273 | '(#:tests? #f | 252 | '(#:tests? #f |
| @@ -286,8 +265,7 @@ | |||
| 286 | 265 | ||
| 287 | (test-equal "input labels, 'safe' policy, nothing changed" | 266 | (test-equal "input labels, 'safe' policy, nothing changed" |
| 288 | (list `(("GMP" ,gmp) ("ACL" ,acl)) | 267 | (list `(("GMP" ,gmp) ("ACL" ,acl)) |
| 289 | "\ | 268 | '((inputs `(("GMP" ,gmp) ("ACL" ,acl))))) |
| 290 | (inputs `((\"GMP\" ,gmp) (\"ACL\" ,acl)))\n") | ||
| 291 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("ACL" ,acl))) | 269 | (call-with-test-package '((inputs `(("GMP" ,gmp) ("ACL" ,acl))) |
| 292 | ;; Non-empty argument list, so potentially unsafe | 270 | ;; Non-empty argument list, so potentially unsafe |
| 293 | ;; input simplification. | 271 | ;; input simplification. |
| @@ -309,8 +287,8 @@ | |||
| 309 | (test-equal "input labels, margin comment" | 287 | (test-equal "input labels, margin comment" |
| 310 | (list `(("gmp" ,gmp)) | 288 | (list `(("gmp" ,gmp)) |
| 311 | `(("acl" ,acl)) | 289 | `(("acl" ,acl)) |
| 312 | " (inputs (list gmp)) ;margin comment\n" | 290 | `((inputs (list gmp)) ,(comment ";margin comment\n" #t)) |
| 313 | " (native-inputs (list acl)) ;another one\n") | 291 | `((native-inputs (list acl)) ,(comment ";another one\n" #t))) |
| 314 | (call-with-test-package '((inputs `(("gmp" ,gmp))) | 292 | (call-with-test-package '((inputs `(("gmp" ,gmp))) |
| 315 | (native-inputs `(("acl" ,acl)))) | 293 | (native-inputs `(("acl" ,acl)))) |
| 316 | (lambda (directory) | 294 | (lambda (directory) |
| @@ -337,15 +315,15 @@ | |||
| 337 | 315 | ||
| 338 | (test-equal "input labels, margin comment on long list" | 316 | (test-equal "input labels, margin comment on long list" |
| 339 | (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) | 317 | (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) |
| 340 | "\ | 318 | `((list gmp ,(comment ";margin comment\n" #t) |
| 341 | (list gmp ;margin comment | 319 | acl |
| 342 | acl | 320 | gmp ,(comment ";margin comment\n" #t) |
| 343 | gmp ;margin comment | 321 | acl |
| 344 | acl | 322 | gmp ,(comment ";margin comment\n" #t) |
| 345 | gmp ;margin comment | 323 | acl |
| 346 | acl | 324 | gmp ,(comment ";margin comment\n" #t) |
| 347 | gmp ;margin comment | 325 | acl) |
| 348 | acl))\n") | 326 | unbalanced)) |
| 349 | (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) | 327 | (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) |
| 350 | ("gmp" ,gmp) ("acl" ,acl) | 328 | ("gmp" ,gmp) ("acl" ,acl) |
| 351 | ("gmp" ,gmp) ("acl" ,acl) | 329 | ("gmp" ,gmp) ("acl" ,acl) |
| @@ -369,10 +347,9 @@ | |||
| 369 | 347 | ||
| 370 | (test-equal "input labels, line comment" | 348 | (test-equal "input labels, line comment" |
| 371 | (list `(("gmp" ,gmp) ("acl" ,acl)) | 349 | (list `(("gmp" ,gmp) ("acl" ,acl)) |
| 372 | "\ | 350 | `((inputs (list gmp |
| 373 | (inputs (list gmp | 351 | ,(comment ";; line comment!\n") |
| 374 | ;; line comment! | 352 | acl)))) |
| 375 | acl))\n") | ||
| 376 | (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) | 353 | (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) |
| 377 | (lambda (directory) | 354 | (lambda (directory) |
| 378 | (define file | 355 | (define file |
| @@ -391,11 +368,10 @@ | |||
| 391 | 368 | ||
| 392 | (test-equal "input labels, modify-inputs and margin comment" | 369 | (test-equal "input labels, modify-inputs and margin comment" |
| 393 | (list `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr)) | 370 | (list `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr)) |
| 394 | "\ | 371 | `((modify-inputs (package-propagated-inputs coreutils) |
| 395 | (modify-inputs (package-propagated-inputs coreutils) | 372 | (prepend gmp ,(comment ";margin comment\n" #t) |
| 396 | (prepend gmp ;margin comment | 373 | acl ,(comment ";another one\n" #t) |
| 397 | acl ;another one | 374 | mpfr)) unbalanced)) |
| 398 | mpfr)))\n") | ||
| 399 | (call-with-test-package '((inputs | 375 | (call-with-test-package '((inputs |
| 400 | `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr) | 376 | `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr) |
| 401 | ,@(package-propagated-inputs coreutils)))) | 377 | ,@(package-propagated-inputs coreutils)))) |
| @@ -435,9 +411,8 @@ | |||
| 435 | 411 | ||
| 436 | (test-equal "gexpify arguments, non-gexp arguments, margin comment" | 412 | (test-equal "gexpify arguments, non-gexp arguments, margin comment" |
| 437 | (list (list #:tests? #f #:test-target "check") | 413 | (list (list #:tests? #f #:test-target "check") |
| 438 | "\ | 414 | `((arguments (list #:tests? #f ,(comment ";no tests\n" #t) |
| 439 | (arguments (list #:tests? #f ;no tests | 415 | #:test-target "check")))) |
| 440 | #:test-target \"check\"))\n") | ||
| 441 | (call-with-test-package '((arguments | 416 | (call-with-test-package '((arguments |
| 442 | '(#:tests? #f | 417 | '(#:tests? #f |
| 443 | #:test-target "check"))) | 418 | #:test-target "check"))) |
| @@ -457,14 +432,13 @@ | |||
| 457 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 2))))) | 432 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 2))))) |
| 458 | 433 | ||
| 459 | (test-equal "gexpify arguments, phases and flags" | 434 | (test-equal "gexpify arguments, phases and flags" |
| 460 | "\ | 435 | `((list #:tests? #f |
| 461 | (list #:tests? #f | 436 | #:configure-flags #~'("--fast") |
| 462 | #:configure-flags #~'(\"--fast\") | 437 | #:make-flags #~(list (string-append "CC=" #$(cc-for-target))) |
| 463 | #:make-flags #~(list (string-append \"CC=\" | 438 | #:phases #~(modify-phases %standard-phases |
| 464 | #$(cc-for-target))) | 439 | ,(comment ";; Line comment.\n") |
| 465 | #:phases #~(modify-phases %standard-phases | 440 | whatever)) |
| 466 | ;; Line comment. | 441 | unbalanced) |
| 467 | whatever)))\n" | ||
| 468 | (call-with-test-package '((arguments | 442 | (call-with-test-package '((arguments |
| 469 | `(#:tests? #f | 443 | `(#:tests? #f |
| 470 | #:configure-flags '("--fast") | 444 | #:configure-flags '("--fast") |
| @@ -487,10 +461,9 @@ | |||
| 487 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) | 461 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) |
| 488 | 462 | ||
| 489 | (test-equal "gexpify arguments, append arguments" | 463 | (test-equal "gexpify arguments, append arguments" |
| 490 | "\ | 464 | `((append (list #:tests? #f |
| 491 | (append (list #:tests? #f | 465 | #:configure-flags #~'("--fast")) |
| 492 | #:configure-flags #~'(\"--fast\")) | 466 | (package-arguments coreutils)) unbalanced) |
| 493 | (package-arguments coreutils)))\n" | ||
| 494 | (call-with-test-package '((arguments | 467 | (call-with-test-package '((arguments |
| 495 | `(#:tests? #f | 468 | `(#:tests? #f |
| 496 | #:configure-flags '("--fast") | 469 | #:configure-flags '("--fast") |
| @@ -506,14 +479,11 @@ | |||
| 506 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 3)))) | 479 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 3)))) |
| 507 | 480 | ||
| 508 | (test-equal "gexpify arguments, substitute-keyword-arguments" | 481 | (test-equal "gexpify arguments, substitute-keyword-arguments" |
| 509 | "\ | 482 | `((substitute-keyword-arguments (package-arguments coreutils) |
| 510 | (substitute-keyword-arguments (package-arguments coreutils) | 483 | ((#:tests? _ #f) |
| 511 | ((#:tests? _ #f) | 484 | #t) |
| 512 | #t) | 485 | ((#:make-flags flags #~'()) |
| 513 | ((#:make-flags flags | 486 | #~(cons "-DXYZ=yes" #$flags))) unbalanced) |
| 514 | #~'()) | ||
| 515 | #~(cons \"-DXYZ=yes\" | ||
| 516 | #$flags))))\n" | ||
| 517 | (call-with-test-package '((arguments | 487 | (call-with-test-package '((arguments |
| 518 | (substitute-keyword-arguments | 488 | (substitute-keyword-arguments |
| 519 | (package-arguments coreutils) | 489 | (package-arguments coreutils) |
| @@ -531,13 +501,9 @@ | |||
| 531 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) | 501 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) |
| 532 | 502 | ||
| 533 | (test-equal "gexpify arguments, substitute-keyword-arguments + unquote-splicing" | 503 | (test-equal "gexpify arguments, substitute-keyword-arguments + unquote-splicing" |
| 534 | "\ | 504 | `((substitute-keyword-arguments (package-arguments coreutils) |
| 535 | (substitute-keyword-arguments (package-arguments coreutils) | 505 | ((#:make-flags flags #~'()) |
| 536 | ((#:make-flags flags | 506 | #~(cons "-DXYZ=yes" #$@(if #t flags '())))) unbalanced) |
| 537 | #~'()) | ||
| 538 | #~(cons \"-DXYZ=yes\" | ||
| 539 | #$@(if #t flags | ||
| 540 | '())))))\n" | ||
| 541 | (call-with-test-package '((arguments | 507 | (call-with-test-package '((arguments |
| 542 | (substitute-keyword-arguments | 508 | (substitute-keyword-arguments |
| 543 | (package-arguments coreutils) | 509 | (package-arguments coreutils) |
| @@ -554,12 +520,10 @@ | |||
| 554 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 6)))) | 520 | (read-package-field (@ (my-packages) my-coreutils) 'arguments 6)))) |
| 555 | 521 | ||
| 556 | (test-equal "gexpify arguments, append substitute-keyword-arguments" | 522 | (test-equal "gexpify arguments, append substitute-keyword-arguments" |
| 557 | "\ | 523 | `((append (list #:tests? #f) |
| 558 | (append (list #:tests? #f) | 524 | (substitute-keyword-arguments (package-arguments coreutils) |
| 559 | (substitute-keyword-arguments (package-arguments coreutils) | 525 | ((#:make-flags flags) |
| 560 | ((#:make-flags flags) | 526 | #~(append `("-n" ,%output) #$flags)))) unbalanced) |
| 561 | #~(append `(\"-n\" ,%output) | ||
| 562 | #$flags)))))\n" | ||
| 563 | (call-with-test-package '((arguments | 527 | (call-with-test-package '((arguments |
| 564 | `(#:tests? #f | 528 | `(#:tests? #f |
| 565 | ,@(substitute-keyword-arguments | 529 | ,@(substitute-keyword-arguments |
| @@ -581,13 +545,16 @@ | |||
| 581 | ;;; | 545 | ;;; |
| 582 | 546 | ||
| 583 | (test-equal "url-fetch->git-fetch, basic transformation" | 547 | (test-equal "url-fetch->git-fetch, basic transformation" |
| 584 | `(origin | 548 | `((origin |
| 585 | (method git-fetch) | 549 | (method git-fetch) |
| 586 | (uri (git-reference (url "https://github.com/foo/bar") | 550 | (uri (git-reference (url "https://github.com/foo/bar") |
| 587 | (commit version))) | 551 | (commit version))) |
| 588 | (file-name (git-file-name name version)) | 552 | (file-name (git-file-name name version)) |
| 589 | (sha256 | 553 | (sha256 |
| 590 | (base32 "0j8vhvfj1d3jvbrd4kh20m50knmwj19xk0l3s78z1xxayp3c5zkk"))) | 554 | (base32 "0j8vhvfj1d3jvbrd4kh20m50knmwj19xk0l3s78z1xxayp3c5zkk"))) |
| 555 | unbalanced | ||
| 556 | (properties (quote ())) | ||
| 557 | unbalanced unbalanced unbalanced) | ||
| 591 | (call-with-test-package | 558 | (call-with-test-package |
| 592 | '((home-page "@substitute-me@") | 559 | '((home-page "@substitute-me@") |
| 593 | (version "1.0") | 560 | (version "1.0") |
| @@ -617,12 +584,22 @@ | |||
| 617 | "https://github.com/foo/bar")) | 584 | "https://github.com/foo/bar")) |
| 618 | 585 | ||
| 619 | (load file) | 586 | (load file) |
| 620 | (and=> (false-if-exception | 587 | (read-package-field (@ (my-packages-0) my-coreutils-0) 'source 8))))) |
| 621 | (read-package-field (@ (my-packages-0) my-coreutils-0) 'source 8)) | ||
| 622 | (cut call-with-input-string <> read)))))) | ||
| 623 | "0")) | 588 | "0")) |
| 624 | 589 | ||
| 625 | (test-assert "url-fetch->git-fetch, preserved field" | 590 | (test-equal "url-fetch->git-fetch, preserved field" |
| 591 | `((origin | ||
| 592 | (method git-fetch) | ||
| 593 | (uri (git-reference | ||
| 594 | (url "https://github.com/foo/bar") | ||
| 595 | (commit version))) | ||
| 596 | (file-name (git-file-name name version)) | ||
| 597 | (sha256 | ||
| 598 | (base32 "0j8vhvfj1d3jvbrd4kh20m50knmwj19xk0l3s78z1xxayp3c5zkk")) | ||
| 599 | (patches (search-patches "foo.patch"))) | ||
| 600 | unbalanced | ||
| 601 | (properties (quote ())) | ||
| 602 | unbalanced unbalanced unbalanced) | ||
| 626 | (call-with-test-package | 603 | (call-with-test-package |
| 627 | '((home-page "@substitute-me@") | 604 | '((home-page "@substitute-me@") |
| 628 | (version "1.0") | 605 | (version "1.0") |
| @@ -664,24 +641,25 @@ | |||
| 664 | (((string-append "file://" repository)) | 641 | (((string-append "file://" repository)) |
| 665 | "https://github.com/foo/bar")) | 642 | "https://github.com/foo/bar")) |
| 666 | (load file) | 643 | (load file) |
| 667 | (and=> (read-package-field | 644 | (read-package-field |
| 668 | (@ (my-packages-1) my-coreutils-1) 'source 9) | 645 | (@ (my-packages-1) my-coreutils-1) 'source 9)))))) |
| 669 | (cut string-contains <> "patches"))))))) | ||
| 670 | "1")) | 646 | "1")) |
| 671 | 647 | ||
| 672 | (unless (false-if-exception | 648 | (unless (false-if-exception |
| 673 | (getaddrinfo "https.git.savannah.gnu.org" "https")) | 649 | (getaddrinfo "https.git.savannah.gnu.org" "https")) |
| 674 | (test-skip 1)) | 650 | (test-skip 1)) |
| 675 | (test-equal "url-fetch->git-fetch, mirror:// URL" | 651 | (test-equal "url-fetch->git-fetch, mirror:// URL" |
| 676 | '(origin | 652 | '((origin |
| 677 | (method git-fetch) | 653 | (method git-fetch) |
| 678 | (uri (git-reference | 654 | (uri (git-reference |
| 679 | (url "https://https.git.savannah.gnu.org/git/sed.git") | 655 | (url "https://https.git.savannah.gnu.org/git/sed.git") |
| 680 | (commit (string-append "v" version)))) | 656 | (commit (string-append "v" version)))) |
| 681 | (file-name (git-file-name name version)) | 657 | (file-name (git-file-name name version)) |
| 682 | (sha256 | 658 | (sha256 |
| 683 | (base32 | 659 | (base32 "00p6v3aa22jz365scmifr06fspkylzrvbqda0waz4x06q5qv0263"))) |
| 684 | "00p6v3aa22jz365scmifr06fspkylzrvbqda0waz4x06q5qv0263"))) | 660 | unbalanced |
| 661 | (properties (quote ())) | ||
| 662 | unbalanced unbalanced unbalanced) | ||
| 685 | (call-with-test-package | 663 | (call-with-test-package |
| 686 | '((version "4.9") | 664 | '((version "4.9") |
| 687 | (source | 665 | (source |
| @@ -699,9 +677,7 @@ | |||
| 699 | (system* "guix" "style" "-L" directory "-S" "git-source" "my-coreutils-1") | 677 | (system* "guix" "style" "-L" directory "-S" "git-source" "my-coreutils-1") |
| 700 | 678 | ||
| 701 | (load file) | 679 | (load file) |
| 702 | (call-with-input-string (read-package-field | 680 | (read-package-field (@ (my-packages-1) my-coreutils-1) 'source 8)) |
| 703 | (@ (my-packages-1) my-coreutils-1) 'source 8) | ||
| 704 | read)) | ||
| 705 | "1")) | 681 | "1")) |
| 706 | 682 | ||
| 707 | (test-assert "url-fetch->git-fetch, non-git home-page unchanged" | 683 | (test-assert "url-fetch->git-fetch, non-git home-page unchanged" |
