I apologize for somewhat later response, I did not manage to allocate
some time to this sooner. :/

Olivier Dion <[email protected]> writes:

> 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.

Well, that is (another) embarrassing bug.  You are of course right and
the proposed fix seem right.

>
> 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))))

I have applied the patch above to my tree (after s|/module/|/wolfsden/|)
and all my tests are still passing.  I have added test for #f in
test-result-ref and manually verified the maybe-print-prop.

I will keep the part for test-result-ref in my tree and credit it to
you, however I believe that due to the size and character of this
change, it does not pass the threshold for copyright, so I will not be
installing LGPL text into the repository (my code is under AGPL).  I
hope that is fine with you, if not, just let me know and I will rewrite
the patch from scratch.

>          
> Thanks,
> Olivier

Thank you ^_^

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature

Reply via email to