lsp-test

Functional test framework for LSP servers. https://github.com/Bubba/haskell-lsp-test#readme

Version on this page:0.5.0.1
Stackage Nightly 2018-12-15:0.5.0.2
Latest on Hackage:0.5.0.2

See all snapshots lsp-test appears in

BSD3 licensed by Luke Lau
Maintained by luke_lau@icloud.com

Module documentation for 0.5.0.1

There are no documented modules for this package.

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.5.0.2 – 2018-12-05

  • Fix loose threads when exceptions are thrown

0.5.0.0 – 2018-11-13

  • Add lspConfig option in config
  • GHC 8.6.2 support

0.4.0.0 – 2018-09-08

  • Update to haskell-lsp-0.8.0.0

0.3.0.0 – 2018-09-0t

  • Update to haskell-lsp-0.7.0.0

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
comments powered byDisqus