X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=test%2FTest.hs;h=5e7e0752032dca5df0da393c7a1a42f27cb1608f;hb=eab96ad6f11e0f76380d9cc600724f94c4523915;hp=d524ee4ffe15c666c8feaabdd5c518e804782a58;hpb=1519d72b72435e798b02bb698eccab8f9683dec1;p=opengl.git diff --git a/test/Test.hs b/test/Test.hs index d524ee4..5e7e075 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -18,7 +18,8 @@ import GHC.Generics import Language.Haskell.LSP.Messages import Language.Haskell.LSP.Test import Language.Haskell.LSP.Test.Replay -import Language.Haskell.LSP.Types as LSP hiding (capabilities, message) +import Language.Haskell.LSP.Types as LSP hiding (capabilities, message, rename, applyEdit) +import Language.Haskell.LSP.Types.Capabilities as LSP import System.Timeout {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} @@ -176,6 +177,13 @@ main = hspec $ do liftIO $ contents `shouldBe` "main :: IO Int\nmain = return 42\n" noDiagnostics + describe "getCodeActions" $ + it "works" $ runSession "hie" fullCaps "test/data/refactor" $ do + doc <- openDoc "Main.hs" "haskell" + waitForDiagnostics + [CACodeAction action] <- getCodeActions doc (Range (Position 1 14) (Position 1 18)) + liftIO $ action ^. title `shouldBe` "Apply hint:Redundant bracket" + describe "getAllCodeActions" $ it "works" $ runSession "hie --lsp" fullCaps "test/data/refactor" $ do doc <- openDoc "Main.hs" "haskell" @@ -199,7 +207,7 @@ main = hspec $ do liftIO $ do mainSymbol ^. name `shouldBe` "main" mainSymbol ^. kind `shouldBe` SkFunction - mainSymbol ^. range `shouldBe` Range (Position 3 0) (Position 3 4) + mainSymbol ^. range `shouldBe` Range (Position 3 0) (Position 5 30) describe "applyEdit" $ do it "increments the version" $ runSession "hie --lsp" docChangesCaps "test/data/renamePass" $ do