bug#81238: Couple of SRFI-64 fixes
Olivier Dion <[email protected]> Sat, 11 Jul 2026 21:17:04 -0400
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <8733xpxazz.fsf@laura> |
On Sat, 11 Jul 2026, Olivier Dion <[email protected]> wrote: > On Sun, 12 Jul 2026, Tomas Volf <[email protected]> wrote: > [...] >> Should I send a patch, or for change of this size it will be faster for >> you to just fix it? > > I'll fix it myself, just wanted to confirm with you :-) [...] Actually, can you just ensure that the following is okay? I stumble across `test-result-ref' and saw that it was using `assoc-ref` directly, which can return `#f' even if the key is present. I decided to use match against `assoc' instead to be on the safe side. diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm index 98f6c8114..36daab2e7 100644 --- a/module/srfi/srfi-64.scm +++ b/module/srfi/srfi-64.scm @@ -320,8 +320,10 @@ fail. This only affects test reporting, not test execution." "Returns the property value associated with the @var{pname} property name. If there is no value associated with @var{pname} return @var{default}, or @code{#f} if @var{default} is not specified." - (or (assoc-ref (test-runner-result-alist runner) pname) - default)) + (match (assoc pname (test-runner-result-alist runner)) + ((key . value) + value) + (#f default))) (define (test-result-set! runner pname value) "Sets the property value associated with the @var{pname} property name to @@ -417,10 +419,12 @@ instead." "Do nothing." #f) +(define nothing (list 'nothing)) + (define (test-on-test-end-simple runner) "Log that test is done." (define (maybe-print-prop prop pretty? code) - (let* ((default (list)) + (let* ((default nothing) (val (test-result-ref runner prop default))) (unless (eq? val default) (format #t "~a: ~@?~&" prop code val)))) Thanks, Olivier -- Olivier Dion