X-Git-Url: https://git.lukelau.me/?a=blobdiff_plain;f=test%2FTest.hs;h=ed8c6b5f5f0c6ce0e8d2b88fd8bbe40bcf0f7efb;hb=14966566f56badb30e257defe62463e484a2892a;hp=c662d46af44fb141fe0ec7d13172fe119dbbb9cc;hpb=51a500ceafa6d32b39e8c79bbb885fd1f0d559a4;p=lsp-test.git diff --git a/test/Test.hs b/test/Test.hs index c662d46..ed8c6b5 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -93,7 +93,9 @@ main = hspec $ do getDocumentSymbols doc -- should now timeout skipManyTill anyMessage message :: Session ApplyWorkspaceEditRequest - in sesh `shouldThrow` (== Timeout) + isTimeout (Timeout _) = True + isTimeout _ = False + in sesh `shouldThrow` isTimeout describe "SessionException" $ do @@ -240,7 +242,8 @@ main = hspec $ do noDiagnostics noDiagnostics - item:_ <- getCompletions doc (Position 5 5) + comps <- getCompletions doc (Position 5 5) + let item = head (filter (\x -> x ^. label == "interactWithUser") comps) liftIO $ do item ^. label `shouldBe` "interactWithUser" item ^. kind `shouldBe` Just CiFunction @@ -275,10 +278,10 @@ main = hspec $ do describe "waitForDiagnosticsSource" $ it "works" $ runSession "hie" fullCaps "test/data" $ do openDoc "Error.hs" "haskell" - [diag] <- waitForDiagnosticsSource "ghcmod" + [diag] <- waitForDiagnosticsSource "bios" liftIO $ do diag ^. severity `shouldBe` Just DsError - diag ^. source `shouldBe` Just "ghcmod" + diag ^. source `shouldBe` Just "bios" describe "rename" $ it "works" $ runSession "hie" fullCaps "test/data" $ do @@ -332,6 +335,12 @@ main = hspec $ do pred _ = False void $ satisfy pred + describe "ignoreLogNotifications" $ + it "works" $ + runSessionWithConfig (defaultConfig { ignoreLogNotifications = True }) "hie" fullCaps "test/data" $ do + openDoc "Format.hs" "haskell" + void publishDiagnosticsNotification + mkRange sl sc el ec = Range (Position sl sc) (Position el ec) didChangeCaps :: ClientCapabilities