Merge branch 'master' into github-actions
authorLuke Lau <luke_lau@icloud.com>
Mon, 25 Nov 2019 17:24:41 +0000 (17:24 +0000)
committerLuke Lau <luke_lau@icloud.com>
Mon, 25 Nov 2019 17:24:41 +0000 (17:24 +0000)
1  2 
README.md
test/Test.hs

diff --combined README.md
index 11f370918e27fb78c08c9f9236d383af5a180b7d,ce452fe715d8858a995bf5a19230a394e8700492..9f0251b3f841dbc46acb7c4fa2d5211338b20239
+++ 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 c662d46af44fb141fe0ec7d13172fe119dbbb9cc,342d889f464d73ce9435c56148bc428c5a7844ae..22f8e21996df80c4b9e9a81b95d07edbab5e72d3
@@@ -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
        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
    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