From: Luke Lau Date: Mon, 25 Nov 2019 17:24:41 +0000 (+0000) Subject: Merge branch 'master' into github-actions X-Git-Url: https://git.lukelau.me/?a=commitdiff_plain;h=803c622b2a390a310584d9f8170c9ec1c8ea67db;hp=-c;p=lsp-test.git Merge branch 'master' into github-actions --- 803c622b2a390a310584d9f8170c9ec1c8ea67db diff --combined README.md index 11f3709,ce452fe..9f0251b --- a/README.md +++ b/README.md @@@ -1,4 -1,4 +1,4 @@@ -# lsp-test [![Build Status](https://travis-ci.com/bubba/lsp-test.svg?branch=master)](https://travis-ci.com/bubba/lsp-test) [![Hackage](https://img.shields.io/hackage/v/lsp-test.svg)](https://hackage.haskell.org/package/lsp-test-0.1.0.0) +# lsp-test [![Actions Status](https://github.com/bubba/lsp-test/workflows/Haskell%20CI/badge.svg)](https://github.com/bubba/lsp-test/actions) [![Hackage](https://img.shields.io/hackage/v/lsp-test.svg)](https://hackage.haskell.org/package/lsp-test-0.1.0.0) lsp-test is a functional testing framework for Language Server Protocol servers. ```haskell @@@ -46,3 -46,6 +46,6 @@@ The tests are integration tests, so mak `npm i -g javascript-typescript-langserver` Then run the tests with `stack test` or `cabal new-test`. + + ## Troubleshooting + Seeing funny stuff when running lsp-test via stack? If your server is built upon Haskell tooling, [keep in mind that stack sets some environment variables related to GHC, and you may want to unset them.](https://github.com/alanz/haskell-ide-engine/blob/bfb16324d396da71000ef81d51acbebbdaa854ab/test/utils/TestUtils.hs#L290-L298) diff --combined test/Test.hs index c662d46,342d889..22f8e21 --- a/test/Test.hs +++ b/test/Test.hs @@@ -16,7 -16,7 +16,7 @@@ import Control.Mona import Control.Lens hiding (List) import GHC.Generics import Language.Haskell.LSP.Messages -import Language.Haskell.LSP.Test +import Language.Haskell.LSP.Test hiding (runSession) import Language.Haskell.LSP.Test.Replay import Language.Haskell.LSP.Types import Language.Haskell.LSP.Types.Lens as LSP hiding @@@ -27,8 -27,6 +27,8 @@@ import System.Timeou {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} {-# ANN module ("HLint: ignore Unnecessary hiding" :: String) #-} +runSession = runSessionWithConfig (defaultConfig { logStdErr = True }) + main = hspec $ do describe "Session" $ do it "fails a test" $ @@@ -46,7 -44,7 +46,7 @@@ describe "withTimeout" $ do it "times out" $ - let sesh = runSession "hie" fullCaps "test/data/renamePass" $ do + let sesh = runSession "hie -d --bios-verbose" fullCaps "test/data/renamePass" $ do openDoc "Desktop/simple.hs" "haskell" -- won't receive a request - will timeout -- incoming logging requests shouldn't increase the @@@ -240,7 -238,8 +240,8 @@@ 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 -274,10 +276,10 @@@ 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