continuable warnings Attila Lendvai (23 Dec 2021 20:26 UTC)
Re: continuable warnings John Cowan (23 Dec 2021 22:31 UTC)
Re: continuable warnings Attila Lendvai (23 Dec 2021 23:03 UTC)
Re: continuable warnings Marc Nieper-Wißkirchen (23 Dec 2021 23:11 UTC)
Re: continuable warnings Attila Lendvai (14 Jan 2023 19:34 UTC)
Re: continuable warnings Marc Nieper-Wißkirchen (14 Jan 2023 19:49 UTC)
Re: continuable warnings Taylan Kammer (23 Dec 2021 22:34 UTC)
Re: continuable warnings John Cowan (23 Dec 2021 22:43 UTC)

Re: continuable warnings Taylan Kammer 23 Dec 2021 22:33 UTC

On 23.12.2021 21:26, Attila Lendvai wrote:
> dear Schemers,
>
> i have recently made a change to Guix where the codebase can raise continuable &warings from anywhere, that then the toplevel UI displays to the user one way or another, and then continues.
>
> unfortunately some tests broke, because the test infrastructure catches any and all conditions, and considers all of them to be unexpected errors.
>
> would it be possible to change the sfri-64 reference implementation so that it ignores continuable warnings? or maybe all continuable exceptions? (i'm rather new to scheme to judge this well)
>
> or should i give up all hope and fix things on my side?
>
> thank you for your consideration,
>
> - attila
> PGP: 5D5F 45C7 DFCD 0A39
>

Wouldn't it be best to write the tests in a way that accounts for this?

For example one could:

1. Write a test that ensures that a certain warning is raised, via test-error:

   (test-error "foo raises warning" &guix-warning-xyz
      (guix-operation-that-raises-warning-xyz))

2. Write a number of additional tests where the test expression catches the
   warnings and chooses different ways to continue:

   (test-assert "foo choice 1"
      (guard (condition
               ((guix-warning-xyz? condition) choice-1))
        (guix-operation-that-raises-warning-xyz)
        #true))

   (test-assert "foo choice 2"
      (guard (condition
               ((guix-warning-xyz? condition) choice-2))
        (guix-operation-that-raises-warning-xyz)
        #true))

   Or whatever makes sense instead of a test-assert with #true at the end,
   such as asserting that a certain value is produced depending on choice.

--
Taylan