Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foo :: Monad m => m Int
- foo = fail "nope"
- spec :: Spec
- spec = do
- describe "foo" $ do
- it "does not work, heatsink (I)" $ do
- let res :: Either String Int
- res = foo
- res @?= Left "nope"
- --uncaught exception: ErrorCall (nope)
- it "does not work, heatsink (II)" $ do
- let res :: Either String Int
- res = foo
- return res `shouldReturn` Left "nope"
- --uncaught exception: ErrorCall (nope)
- it "works!" $ do
- let res :: Maybe Int
- res = foo
- res `shouldBe` Nothing
- it "this does not work" $ do
- let res :: Either String Int
- res = foo
- exp :: Either String Int
- exp = Left "nope"
- res `shouldBe` exp
- -- uncaught exception: ErrorCall (nope)
- it "this does not work either..." $ do
- let res :: Either String Int
- res = foo
- return res `shouldThrow` anyException
- -- did not get expected exception: SomeException
- it "...neither this" $ do
- let res :: Either String Int
- res = foo
- return res `shouldThrow` errorCall "nope"
- -- did not get expected exception: ErrorCall
- it "...nor this" $ do
- let res :: Either String Int
- res = foo
- return res `shouldThrow` anyErrorCall
- -- did not get expected exception: ErrorCall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement