X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=test%2FParsingTests.hs;fp=test%2FParsingTests.hs;h=0000000000000000000000000000000000000000;hp=fe8d36671d7fca4192498a12a3445c67a1d3a397;hb=fbb260c6078a39ff071fefd6586af18715b3e6a3;hpb=54b23e6b7a8aa59e649a807ab286f0808908935a diff --git a/test/ParsingTests.hs b/test/ParsingTests.hs deleted file mode 100644 index fe8d366..0000000 --- a/test/ParsingTests.hs +++ /dev/null @@ -1,44 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE FlexibleInstances #-} -module ParsingTests where - -import Control.Lens hiding (List) -import Language.Haskell.LSP.Messages -import Language.Haskell.LSP.Test -import Language.Haskell.LSP.Types -import Data.Conduit -import Data.Conduit.Parser -import Data.Default -import Test.Hspec - -type TestSession = ConduitParser FromServerMessage IO - -instance MonadSessionConfig IO where - sessionConfig = return def - -parsingSpec :: Spec -parsingSpec = - describe "diagnostics" $ do - let testDiag = NotPublishDiagnostics - (NotificationMessage "2.0" - TextDocumentPublishDiagnostics - (PublishDiagnosticsParams (Uri "foo") - (List []))) - it "get picked up" $ do - let source = yield testDiag - session = do - diags <- publishDiagnosticsNotification :: TestSession PublishDiagnosticsNotification - return $ diags ^. params . uri - runConduit (source .| runConduitParser session) `shouldReturn` Uri "foo" - it "get picked up after skipping others before" $ do - let testDiag = NotPublishDiagnostics - (NotificationMessage "2.0" - TextDocumentPublishDiagnostics - (PublishDiagnosticsParams (Uri "foo") - (List []))) - notTestDiag = NotLogMessage (NotificationMessage "2.0" WindowLogMessage (LogMessageParams MtLog "foo")) - source = yield notTestDiag >> yield testDiag - session = do - diags <- skipManyTill anyNotification notification :: TestSession PublishDiagnosticsNotification - return $ diags ^. params . uri - runConduit (source .| runConduitParser session) `shouldReturn` Uri "foo" \ No newline at end of file