20 lines
652 B
Haskell
20 lines
652 B
Haskell
module MonadSpec where
|
|
|
|
import Test.Hspec
|
|
import Control.Monad.Error.Class
|
|
import Language.Haskell.GhcMod.Types
|
|
import Language.Haskell.GhcMod.Monad
|
|
import Language.Haskell.GhcMod.Find
|
|
|
|
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
|
|
(a, w)
|
|
<- runGhcModT defaultOptions $
|
|
do
|
|
Just a <- return Nothing
|
|
return "hello"
|
|
`catchError` (const $ fail "oh noes")
|
|
a `shouldBe` (Left $ GMEString "oh noes")
|