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>
This commit is contained in:
Ludovic Courtès 2026-01-03 22:15:15 +01:00 committed by Andreas Enge
parent adbc61ecf4
commit b5ab02eada
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3
5 changed files with 29 additions and 10 deletions

View file

@ -22,6 +22,7 @@
#:use-module (guix modules)
#:use-module (gnu system file-systems)
#:use-module (srfi srfi-1)
#:use-module ((srfi srfi-35) #:select (&message))
#:use-module (srfi srfi-64)
#:use-module (ice-9 match))
@ -124,6 +125,7 @@
%btrfs-store-subvolume))))
(test-error "btrfs-store-subvolume-file-name (subvolid)"
&message
(parameterize ((%store-prefix "/gnu/store"))
(btrfs-store-subvolume-file-name (list %btrfs-root-subvolume
%btrfs-store-subvolid))))

View file

@ -18,6 +18,7 @@
(define-module (tests services file-sharing)
#:use-module (gnu services file-sharing)
#:use-module ((guix diagnostics) #:select (formatted-message?))
#:use-module (srfi srfi-64))
;;; Tests for the (gnu services file-sharing) module.
@ -47,11 +48,13 @@
(transmission-password-hash "" "Cp.I5SWg"))
(test-error "transmission-password-hash, salt value too short"
formatted-message?
(transmission-password-hash
"transmission"
(make-string (- %transmission-salt-length 1) #\a)))
(test-error "transmission-password-hash, salt value too long"
formatted-message?
(transmission-password-hash
"transmission"
(make-string (+ %transmission-salt-length 1) #\a)))

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2021, 2023, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012-2021, 2023, 2025-2026 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -94,8 +94,8 @@
(string-append (%store-prefix)
"/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")))
(test-equal "store-path-package-name #f"
#f
(test-error "store-path-package-name #f"
#t ;any exception
(store-path-package-name
"/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))

View file

@ -20,7 +20,9 @@
#:use-module ((gcrypt hash) #:select (port-sha256))
#:use-module (guix packages)
#:use-module (guix scripts style)
#:use-module ((guix utils) #:select (call-with-temporary-directory))
#:use-module ((guix utils)
#:select (guile-version>?
call-with-temporary-directory))
#:use-module ((guix build utils) #:select (substitute*))
#:use-module (guix gexp) ;for the reader extension
#:use-module (guix diagnostics)
@ -136,6 +138,14 @@
(test-begin "style")
(when (guile-version>? "3.0.9")
;; The output of 'pretty-print' changed in Guile 3.0.10. These tests are
;; currently written against the output of 'pretty-print' from 3.0.9, so
;; skip them when running on a newer version.
;;
;; TODO: Adjust tests for 3.0.10+.
(test-skip 1000))
(test-equal "nothing to rewrite"
'()
(with-test-package '()

View file

@ -23,6 +23,10 @@
#:use-module (srfi srfi-64)
#:use-module (ice-9 match))
;; Work around <https://codeberg.org/guix/guix/issues/5339>.
(module-set! (resolve-module '(guix build toml))
'raise (@ (srfi srfi-34) raise))
(test-begin "toml")
;; Tests taken from https://toml.io/en/v1.0.0
@ -60,8 +64,8 @@ bare-key = \"value\"
(parse-toml "\"key \\\\ with \\n escapes\" = \"value\"
key.\"with \\t escapes\".\"and \\n dots\" = \"value\""))
(test-equal "parse-toml: No key"
#f
(test-error "parse-toml: No key"
&file-not-consumed
(parse-toml "= \"no key name\""))
(test-equal "parse-toml: Empty key"
@ -381,8 +385,8 @@ apple = \"red\"
[fruit]
orange = \"orange\""))
(test-equal "parse-toml: Assignment to non-table"
#f
(test-error "parse-toml: Assignment to non-table"
#t
(parse-toml "[fruit]
apple = \"red\"
@ -419,7 +423,7 @@ type.edible = false # INVALID"))
;; We do not catch this semantic error yet.
(test-expect-fail 1)
(test-error "parse-toml: Invalid assignment to implicit table"
#f
#t
(parse-toml "[product]
type.name = \"Nail\"
type = { edible = false } # INVALID"))
@ -473,7 +477,7 @@ name = \"plantain\""))
;; Not implemented.
(test-expect-fail 1)
(test-error "parse-toml: Assignment to statically defined array"
#f
#t
(parse-toml "fruits = []
[[fruits]]