lsp-test 0.5.0.1 → 0.5.0.2
raw patch · 5 files changed
+30/−10 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- ChangeLog.md +17/−0
- lsp-test.cabal +1/−1
- src/Language/Haskell/LSP/Test/Decoding.hs +8/−2
- src/Language/Haskell/LSP/Test/Session.hs +3/−5
- test/Test.hs +1/−2
ChangeLog.md view
@@ -1,5 +1,22 @@ # 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
lsp-test.cabal view
@@ -1,5 +1,5 @@ name: lsp-test-version: 0.5.0.1+version: 0.5.0.2 synopsis: Functional test framework for LSP servers. description: A test framework for writing tests against
src/Language/Haskell/LSP/Test/Decoding.hs view
@@ -3,12 +3,15 @@ import Prelude hiding ( id ) import Data.Aeson+import Control.Exception import Control.Lens import qualified Data.ByteString.Lazy.Char8 as B import Data.Maybe import System.IO+import System.IO.Error import Language.Haskell.LSP.Types-import Language.Haskell.LSP.Types.Lens hiding (error)+import Language.Haskell.LSP.Types.Lens+ hiding ( error ) import Language.Haskell.LSP.Messages import qualified Data.HashMap.Strict as HM @@ -42,9 +45,12 @@ getHeaders :: Handle -> IO [(String, String)] getHeaders h = do- l <- hGetLine h+ l <- catch (hGetLine h) eofHandler let (name, val) = span (/= ':') l if null val then return [] else ((name, drop 2 val) :) <$> getHeaders h+ where eofHandler e+ | isEOFError e = error "Language Server unexpectedly terminated"+ | otherwise = throw e type RequestMap = HM.HashMap LspId ClientMethod
src/Language/Haskell/LSP/Test/Session.hs view
@@ -203,11 +203,9 @@ let context = SessionContext serverIn absRootDir messageChan reqMap initRsp config caps initState = SessionState (IdInt 0) mempty mempty 0 False Nothing-- threadId <- forkIO $ void $ serverHandler serverOut context- (result, _) <- runSession context initState session-- killThread threadId+ launchServerHandler = forkIO $ void $ serverHandler serverOut context+ (result, _) <- bracket launchServerHandler killThread $+ const $ runSession context initState session return result
test/Test.hs view
@@ -30,12 +30,11 @@ main = hspec $ do describe "Session" $ do it "fails a test" $- -- TODO: Catch the exception in haskell-lsp-test and provide nicer output let session = runSession "hie" fullCaps "test/data/renamePass" $ do openDoc "Desktop/simple.hs" "haskell" skipMany loggingNotification anyRequest- in session `shouldThrow` anyException+ in session `shouldThrow` anySessionException it "initializeResponse" $ runSession "hie" fullCaps "test/data/renamePass" $ do rsp <- initializeResponse liftIO $ rsp ^. result `shouldNotBe` Nothing