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

Reply via email to