GNU bug report logs -
#74030
[PATCH] srfi-64: Accept symbols as test group names.
Previous Next
Reported by: Tomas Volf <~@wolfsden.cz>
Date: Sat, 26 Oct 2024 16:08:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74030 in the body.
You can then email your comments to 74030 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#74030
; Package
guile
.
(Sat, 26 Oct 2024 16:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tomas Volf <~@wolfsden.cz>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sat, 26 Oct 2024 16:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The specification mandates a string, but with rationale suggesting symbols
would be a more natural fit.
> In some ways using symbols would be preferable. However, we want
> human-readable names, and standard Scheme does not provide a way to include
> spaces or mixed-case text in literal symbols.
Add support for symbols as implementation extension.
* module/srfi/srfi-64.scm (%cmp-group-name): New procedure.
(test-end): Use it.
---
module/srfi/srfi-64.scm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm
index 1f60a72e5..98fcef645 100644
--- a/module/srfi/srfi-64.scm
+++ b/module/srfi/srfi-64.scm
@@ -522,7 +522,10 @@ returning new test runner. Defaults to @code{test-runner-simple}.")
(1+ (group-executed-count group)))))))
(define* (test-begin suite-name #:optional count)
- "Enter a new test group."
+ "Enter a new test group.
+
+As implementation extension, in addition to strings, symbols are also
+supported as @var{suite-name}."
(let* ((r (test-runner-current))
(r install? (if r
(values r #f)
@@ -544,6 +547,14 @@ returning new test runner. Defaults to @code{test-runner-simple}.")
((test-runner-on-group-begin r) r suite-name count)))
+(define (%cmp-group-name a b)
+ (match (list a b)
+ (((? string?) (? string?))
+ (string=? a b))
+ (((? symbol?) (? symbol?))
+ (eq? a b))
+ (_ #f)))
+
(define* (test-end #:optional suite-name)
"Leave the current test group."
(let* ((r (test-runner-current))
@@ -551,7 +562,7 @@ returning new test runner. Defaults to @code{test-runner-simple}.")
(let ((begin-name (car (test-runner-group-stack r)))
(end-name suite-name))
- (when (and end-name (not (string=? begin-name end-name)))
+ (when (and end-name (not (%cmp-group-name begin-name end-name)))
((test-runner-on-bad-end-name r) r begin-name end-name)
(raise-exception (make-bad-end-name begin-name end-name))))
--
2.46.0
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Sat, 26 Oct 2024 17:22:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tomas Volf <~@wolfsden.cz>
:
bug acknowledged by developer.
(Sat, 26 Oct 2024 17:22:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 74030-done <at> debbugs.gnu.org (full text, mbox):
Tomas Volf <~@wolfsden.cz> skribis:
> The specification mandates a string, but with rationale suggesting symbols
> would be a more natural fit.
>
>> In some ways using symbols would be preferable. However, we want
>> human-readable names, and standard Scheme does not provide a way to include
>> spaces or mixed-case text in literal symbols.
>
> Add support for symbols as implementation extension.
>
> * module/srfi/srfi-64.scm (%cmp-group-name): New procedure.
> (test-end): Use it.
I added “for backwards compatibility with the reference implementation”
and credited Daniel for reporting the issue.
Applied, thanks!
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 24 Nov 2024 12:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.