I don't think running Exception.message will cut it, since it will output a 
string that the message/1 implementation failed. Ideally, I wish the test would 
fail in that case.

One solution would be to call error_module.message(error) manually, but this 
would mean ex_unit needs to replicate logic from Exception.message. Alternative 
would be to pattern match on the string returned from Exception.message, but 
this seems even more error-prone.

Michał.

On 16 Jun 2017, 15:02 +0200, José Valim <[email protected]>, 
wrote:
> Great catch. Yes, let's always invoke Exception.message on it, even if you 
> don't match on it.
>
>
>
> José Valim
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> > On Fri, Jun 16, 2017 at 2:54 PM, Michał Muskała <[email protected]> wrote:
> > > Hello everybody,
> > >
> > > Right now, when using assert_raise/2 (without passing the message) the 
> > > test succeeds even if the exception itself has bad implementation of the 
> > > message/1 function and raises.
> > >
> > > I propose that assert_raise should fail whenever such a broken exception 
> > > implementation is encountered. This should allow catching additional bugs 
> > > in test suites.
> > >
> > > Michał.
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "elixir-lang-core" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to [email protected].
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/elixir-lang-core/4b610622-28db-4025-95c4-0cfe7d9bbdf1%40Spark.
> > > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KS0XvaSSAjtr3pkD3Edi6R%2B6yrASkHfJN99CZXUiGf-Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/1e15b652-1d72-4dcd-862c-6378ed51fb07%40Spark.
For more options, visit https://groups.google.com/d/optout.

Reply via email to