[Haskell-beginners] How to test "error"?

Francesco Ariis fa-ml at ariis.it
Tue Jun 11 09:39:09 UTC 2019


Hello Hilco,

On Mon, Jun 10, 2019 at 08:44:30PM -0700, Hilco Wijbenga wrote:
> f :: Whatever
> f = error "This should never happen."
> 
> spec :: Spec
> spec =
>     describe "f" $
>         it "error" $
>             return f `shouldThrow` anyErrorCall

    import qualified Control.Exception as E

and

    E.evaluate tt' f `shouldThrow` anyErrorCall

should work. Does this work?
-F


More information about the Beginners mailing list