Add a test making sure pattern match failures on GhcModT work the way I expect
This commit is contained in:
parent
fad99f466f
commit
7388b50474
@ -169,6 +169,7 @@ Test-Suite spec
|
|||||||
LangSpec
|
LangSpec
|
||||||
LintSpec
|
LintSpec
|
||||||
ListSpec
|
ListSpec
|
||||||
|
MonadSpec
|
||||||
GhcPkgSpec
|
GhcPkgSpec
|
||||||
TestUtils
|
TestUtils
|
||||||
Build-Depends: base >= 4.0 && < 5
|
Build-Depends: base >= 4.0 && < 5
|
||||||
|
19
test/MonadSpec.hs
Normal file
19
test/MonadSpec.hs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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")
|
Loading…
Reference in New Issue
Block a user