[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#42146] [PATCH core-updates 1/?] build: substitute: Don't fail silen
From: |
Ludovic Courtès |
Subject: |
[bug#42146] [PATCH core-updates 1/?] build: substitute: Don't fail silently. |
Date: |
Mon, 23 Oct 2023 10:48:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> From: Jakub Kądziołka <kuba@kadziolka.net>
>
> * guix/build/utils.scm (substitute, substitute*)
> [require-matches?]: New argument.
> * tests/build-utils.scm ("substitute*"): New test group.
> ("substitute*, no match error")
> ("substitute*, partial no match error"): New tests.
>
> Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Change-Id: I66ed33d72aa73cd35e5642521efec70bf756f86e
[…]
> +(define-condition-type &substitute-error &error
> + substitute-error?
> + (file substitute-error-file)
> + (patterns substitute-error-patterns))
> +
> +(define %substitute-requires-matches?
> + (make-parameter #t))
[…]
> @@ -1048,9 +1086,19 @@ (define-syntax substitute*
> Alternatively, FILE may be a list of file names, in which case they are
> all subject to the substitutions.
>
> +By default, SUBSTITUTE* will raise a &message condition if one of the
> patterns
I think it’s ‘&substitute-error’ rather than ‘&message’.
> +(define-substitute*-test test-error "substitute*, partial no match error"
> + #t ;expected
> + "a\0b" ;content
> + (("a") "c"
> + ("Oops!") "c"))
Maybe it’s not all that important here, but I think ‘test-error’ tests
for any exception, whereas we’re looking specifically for a
‘&substitute-error’ condition filled with the right values.
Ludo’.