diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-01-03 22:15:15 +0100 |
|---|---|---|
| committer | Rutherther <rutherther@ditigal.xyz> | 2026-01-25 21:23:25 +0100 |
| commit | d118a89d62ef1e85199f90a1267e555b49d38ee8 (patch) | |
| tree | 8b88ea5d9977e05d8c37d1bd72f772575e22c446 /tests | |
| parent | 64acb4e65d32299e4547f6432bff1ffb74d27699 (diff) | |
tests: Adjust to Guile 3.0.10+.
Guile 3.0.11 introduced a new implementation of (srfi srfi-34) with subtle
changes wrt. exceptionm handling. This adjusts to these changes.
Changes in ‘tests/style.scm’ are due to the new output of (ice-9 pretty-print)
in 3.0.10.
* tests/file-systems.scm ("btrfs-store-subvolume-file-name (subvolid)"):
Specify the exception type.
* tests/services/file-sharing.scm ("transmission-password-hash, salt value too short")
("transmission-password-hash, salt value too long"): Likewise.
* tests/store.scm ("store-path-package-name #f"): Change to ‘test-error’
with #t as the exception type.
* tests/style.scm: Skip all the tests on Guile > 3.0.9.
* tests/toml.scm <top level>: Set ‘raise’ in (guix build toml).
("parse-toml: No key"): Use ‘test-error’ instead of ‘test-equal’.
("parse-toml: Assignment to non-table"): Likewise.
("parse-toml: Invalid assignment to implicit table"): Change exception type
to #t
("parse-toml: Assignment to statically defined array"): Likewise.
Change-Id: I54ea77f22d3e95f72dad90690631876e7f013054
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/file-systems.scm | 2 | ||||
| -rw-r--r-- | tests/services/file-sharing.scm | 3 | ||||
| -rw-r--r-- | tests/store.scm | 6 | ||||
| -rw-r--r-- | tests/style.scm | 12 | ||||
| -rw-r--r-- | tests/toml.scm | 16 |
5 files changed, 29 insertions, 10 deletions
diff --git a/tests/file-systems.scm b/tests/file-systems.scm index 1c58454fa23..cffe70375b0 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #:use-module (guix modules) | 22 | #:use-module (guix modules) |
| 23 | #:use-module (gnu system file-systems) | 23 | #:use-module (gnu system file-systems) |
| 24 | #:use-module (srfi srfi-1) | 24 | #:use-module (srfi srfi-1) |
| 25 | #:use-module ((srfi srfi-35) #:select (&message)) | ||
| 25 | #:use-module (srfi srfi-64) | 26 | #:use-module (srfi srfi-64) |
| 26 | #:use-module (ice-9 match)) | 27 | #:use-module (ice-9 match)) |
| 27 | 28 | ||
| @@ -124,6 +125,7 @@ | |||
| 124 | %btrfs-store-subvolume)))) | 125 | %btrfs-store-subvolume)))) |
| 125 | 126 | ||
| 126 | (test-error "btrfs-store-subvolume-file-name (subvolid)" | 127 | (test-error "btrfs-store-subvolume-file-name (subvolid)" |
| 128 | &message | ||
| 127 | (parameterize ((%store-prefix "/gnu/store")) | 129 | (parameterize ((%store-prefix "/gnu/store")) |
| 128 | (btrfs-store-subvolume-file-name (list %btrfs-root-subvolume | 130 | (btrfs-store-subvolume-file-name (list %btrfs-root-subvolume |
| 129 | %btrfs-store-subvolid)))) | 131 | %btrfs-store-subvolid)))) |
diff --git a/tests/services/file-sharing.scm b/tests/services/file-sharing.scm index 27bec57325f..76b4e5dc55a 100644 --- a/tests/services/file-sharing.scm +++ b/tests/services/file-sharing.scm | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | (define-module (tests services file-sharing) | 19 | (define-module (tests services file-sharing) |
| 20 | #:use-module (gnu services file-sharing) | 20 | #:use-module (gnu services file-sharing) |
| 21 | #:use-module ((guix diagnostics) #:select (formatted-message?)) | ||
| 21 | #:use-module (srfi srfi-64)) | 22 | #:use-module (srfi srfi-64)) |
| 22 | 23 | ||
| 23 | ;;; Tests for the (gnu services file-sharing) module. | 24 | ;;; Tests for the (gnu services file-sharing) module. |
| @@ -47,11 +48,13 @@ | |||
| 47 | (transmission-password-hash "" "Cp.I5SWg")) | 48 | (transmission-password-hash "" "Cp.I5SWg")) |
| 48 | 49 | ||
| 49 | (test-error "transmission-password-hash, salt value too short" | 50 | (test-error "transmission-password-hash, salt value too short" |
| 51 | formatted-message? | ||
| 50 | (transmission-password-hash | 52 | (transmission-password-hash |
| 51 | "transmission" | 53 | "transmission" |
| 52 | (make-string (- %transmission-salt-length 1) #\a))) | 54 | (make-string (- %transmission-salt-length 1) #\a))) |
| 53 | 55 | ||
| 54 | (test-error "transmission-password-hash, salt value too long" | 56 | (test-error "transmission-password-hash, salt value too long" |
| 57 | formatted-message? | ||
| 55 | (transmission-password-hash | 58 | (transmission-password-hash |
| 56 | "transmission" | 59 | "transmission" |
| 57 | (make-string (+ %transmission-salt-length 1) #\a))) | 60 | (make-string (+ %transmission-salt-length 1) #\a))) |
diff --git a/tests/store.scm b/tests/store.scm index 82fb7a96cea..1f69f14cdcd 100644 --- a/tests/store.scm +++ b/tests/store.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012-2021, 2023, 2025 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012-2021, 2023, 2025-2026 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -94,8 +94,8 @@ | |||
| 94 | (string-append (%store-prefix) | 94 | (string-append (%store-prefix) |
| 95 | "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) | 95 | "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) |
| 96 | 96 | ||
| 97 | (test-equal "store-path-package-name #f" | 97 | (test-error "store-path-package-name #f" |
| 98 | #f | 98 | #t ;any exception |
| 99 | (store-path-package-name | 99 | (store-path-package-name |
| 100 | "/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")) | 100 | "/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")) |
| 101 | 101 | ||
diff --git a/tests/style.scm b/tests/style.scm index 09e577677d7..bc918a68bbd 100644 --- a/tests/style.scm +++ b/tests/style.scm | |||
| @@ -20,7 +20,9 @@ | |||
| 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 scripts style) | 22 | #:use-module (guix scripts style) |
| 23 | #:use-module ((guix utils) #:select (call-with-temporary-directory)) | 23 | #:use-module ((guix utils) |
| 24 | #:select (guile-version>? | ||
| 25 | call-with-temporary-directory)) | ||
| 24 | #:use-module ((guix build utils) #:select (substitute*)) | 26 | #:use-module ((guix build utils) #:select (substitute*)) |
| 25 | #:use-module (guix gexp) ;for the reader extension | 27 | #:use-module (guix gexp) ;for the reader extension |
| 26 | #:use-module (guix diagnostics) | 28 | #:use-module (guix diagnostics) |
| @@ -136,6 +138,14 @@ | |||
| 136 | 138 | ||
| 137 | (test-begin "style") | 139 | (test-begin "style") |
| 138 | 140 | ||
| 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 | |||
| 139 | (test-equal "nothing to rewrite" | 149 | (test-equal "nothing to rewrite" |
| 140 | '() | 150 | '() |
| 141 | (with-test-package '() | 151 | (with-test-package '() |
diff --git a/tests/toml.scm b/tests/toml.scm index 955a9967b21..b40129f393a 100644 --- a/tests/toml.scm +++ b/tests/toml.scm | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | #:use-module (srfi srfi-64) | 23 | #:use-module (srfi srfi-64) |
| 24 | #:use-module (ice-9 match)) | 24 | #:use-module (ice-9 match)) |
| 25 | 25 | ||
| 26 | ;; Work around <https://codeberg.org/guix/guix/issues/5339>. | ||
| 27 | (module-set! (resolve-module '(guix build toml)) | ||
| 28 | 'raise (@ (srfi srfi-34) raise)) | ||
| 29 | |||
| 26 | (test-begin "toml") | 30 | (test-begin "toml") |
| 27 | 31 | ||
| 28 | ;; Tests taken from https://toml.io/en/v1.0.0 | 32 | ;; Tests taken from https://toml.io/en/v1.0.0 |
| @@ -60,8 +64,8 @@ bare-key = \"value\" | |||
| 60 | (parse-toml "\"key \\\\ with \\n escapes\" = \"value\" | 64 | (parse-toml "\"key \\\\ with \\n escapes\" = \"value\" |
| 61 | key.\"with \\t escapes\".\"and \\n dots\" = \"value\"")) | 65 | key.\"with \\t escapes\".\"and \\n dots\" = \"value\"")) |
| 62 | 66 | ||
| 63 | (test-equal "parse-toml: No key" | 67 | (test-error "parse-toml: No key" |
| 64 | #f | 68 | &file-not-consumed |
| 65 | (parse-toml "= \"no key name\"")) | 69 | (parse-toml "= \"no key name\"")) |
| 66 | 70 | ||
| 67 | (test-equal "parse-toml: Empty key" | 71 | (test-equal "parse-toml: Empty key" |
| @@ -381,8 +385,8 @@ apple = \"red\" | |||
| 381 | [fruit] | 385 | [fruit] |
| 382 | orange = \"orange\"")) | 386 | orange = \"orange\"")) |
| 383 | 387 | ||
| 384 | (test-equal "parse-toml: Assignment to non-table" | 388 | (test-error "parse-toml: Assignment to non-table" |
| 385 | #f | 389 | #t |
| 386 | (parse-toml "[fruit] | 390 | (parse-toml "[fruit] |
| 387 | apple = \"red\" | 391 | apple = \"red\" |
| 388 | 392 | ||
| @@ -419,7 +423,7 @@ type.edible = false # INVALID")) | |||
| 419 | ;; We do not catch this semantic error yet. | 423 | ;; We do not catch this semantic error yet. |
| 420 | (test-expect-fail 1) | 424 | (test-expect-fail 1) |
| 421 | (test-error "parse-toml: Invalid assignment to implicit table" | 425 | (test-error "parse-toml: Invalid assignment to implicit table" |
| 422 | #f | 426 | #t |
| 423 | (parse-toml "[product] | 427 | (parse-toml "[product] |
| 424 | type.name = \"Nail\" | 428 | type.name = \"Nail\" |
| 425 | type = { edible = false } # INVALID")) | 429 | type = { edible = false } # INVALID")) |
| @@ -473,7 +477,7 @@ name = \"plantain\"")) | |||
| 473 | ;; Not implemented. | 477 | ;; Not implemented. |
| 474 | (test-expect-fail 1) | 478 | (test-expect-fail 1) |
| 475 | (test-error "parse-toml: Assignment to statically defined array" | 479 | (test-error "parse-toml: Assignment to statically defined array" |
| 476 | #f | 480 | #t |
| 477 | (parse-toml "fruits = [] | 481 | (parse-toml "fruits = [] |
| 478 | 482 | ||
| 479 | [[fruits]] | 483 | [[fruits]] |
