2014-08-06 18:41:59 +00:00
|
|
|
module MonadSpec where
|
|
|
|
|
|
|
|
import Test.Hspec
|
2014-08-12 16:11:32 +00:00
|
|
|
import TestUtils
|
2014-08-06 18:41:59 +00:00
|
|
|
import Control.Monad.Error.Class
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = do
|
|
|
|
describe "When using GhcModT in a do block" $
|
|
|
|
it "a pattern match failure causes a call to `fail` on ErrorT in the monad stack" $ do
|
2015-03-04 20:48:21 +00:00
|
|
|
(a, _h)
|
2015-09-14 08:11:33 +00:00
|
|
|
<- runGmOutDef $ runGhcModT defaultOptions $
|
2014-08-06 18:41:59 +00:00
|
|
|
do
|
2014-08-20 03:14:27 +00:00
|
|
|
Just _ <- return Nothing
|
2014-08-06 18:41:59 +00:00
|
|
|
return "hello"
|
|
|
|
`catchError` (const $ fail "oh noes")
|
|
|
|
a `shouldBe` (Left $ GMEString "oh noes")
|