BSD-3-Clause licensed by Luke Lau
Maintained by [email protected]
This version can be pinned in stack with:lsp-test-0.5.0.1@sha256:f0a7e13faf26355c554d2186ab1fded0b21a2188aa7e4696173e8779ce48ccaa,3458

Module documentation for 0.5.0.1

  • Language
    • Language.Haskell
      • Language.Haskell.LSP
        • Language.Haskell.LSP.Test
          • Language.Haskell.LSP.Test.Replay

lsp-test Build Status Hackage

lsp-test is a functional testing framework for Language Server Protocol servers.

import Language.Haskell.LSP.Test
runSession "hie" fullCaps "proj/dir" $ do
  doc <- openDoc "Foo.hs" "haskell"
  skipMany anyNotification
  symbols <- getDocumentSymbols doc

Examples

Unit tests with HSpec

describe "diagnostics" $
  it "report errors" $ runSession "hie" fullCaps "test/data" $ do
    openDoc "Error.hs" "haskell"
    [diag] <- waitForDiagnosticsSource "ghcmod"
    liftIO $ do
      diag ^. severity `shouldBe` Just DsError
      diag ^. source `shouldBe` Just "ghcmod"

Replaying captured session

replaySession "hie" "test/data/renamePass"

Parsing with combinators

skipManyTill loggingNotification publishDiagnosticsNotification
count 4 (message :: Session ApplyWorkspaceEditRequest)
anyRequest <|> anyResponse

Try out the example tests in the example directory with cabal new-test. For more examples check the Wiki

Developing

To test make sure you have the following language servers installed:

Changes

Revision history for lsp-test

0.2.1.0 – 2018-08-14

  • Add getCodeActions
  • Add getCurrentDiagnostics

0.2.0.0 – 2018-08-06

  • Update to haskell-lsp 0.6.0.0