Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 4d725b8

Browse files
committed
Add a test case
Related to #451, #1220
1 parent a185f77 commit 4d725b8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/testdata/ApplyRefactError.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hoge :: forall a. (a -> a) -> a -> a
2+
hoge f x = f $ x

test/unit/ApplyRefactPluginSpec.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
module ApplyRefactPluginSpec where
55

66
import qualified Data.HashMap.Strict as H
7+
import qualified Data.Text as T
78
import Haskell.Ide.Engine.Plugin.ApplyRefact
89
import Haskell.Ide.Engine.MonadTypes
910
import Haskell.Ide.Engine.PluginUtils
@@ -153,3 +154,15 @@ applyRefactSpec = do
153154
, _diagnostics = List []
154155
}
155156
))
157+
158+
-- ---------------------------------
159+
160+
it "reports error without crash" $ do
161+
filePath <- filePathToUri <$> makeAbsolute "./test/testdata/ApplyRefactError.hs"
162+
163+
let req = applyAllCmd' filePath
164+
isExpectedError (IdeResultFail (IdeError PluginError err _)) =
165+
"Illegal symbol '.' in type" `T.isInfixOf` err
166+
isExpectedError _ = False
167+
r <- withCurrentDirectory "./test/testdata" $ runIGM testPlugins req
168+
r `shouldSatisfy` isExpectedError

0 commit comments

Comments
 (0)