From: Luke Lau Date: Mon, 11 Jun 2018 14:31:29 +0000 (-0400) Subject: Merge branch 'master' of https://github.com/Bubba/haskell-lsp-test X-Git-Tag: 0.1.0.0~76 X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=commitdiff_plain;h=bc52b000bf018360efbfa0fcd289329c70d2c77e Merge branch 'master' of https://github.com/Bubba/haskell-lsp-test --- bc52b000bf018360efbfa0fcd289329c70d2c77e diff --cc src/Language/Haskell/LSP/Test.hs index 087143f,fb928a4..79b7b1e --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@@ -95,11 -95,11 +96,11 @@@ runSession serverExe rootDir session = def (Just TraceOff) - runSessionWithHandler listenServer rootDir $ do + runSessionWithHandler listenServer serverExe rootDir $ do -- Wrap the session around initialize and shutdown calls - sendRequest (Proxy :: Proxy InitializeRequest) Initialize initializeParams - RspInitialize initRsp <- response + sendRequest Initialize initializeParams + initRsp <- response :: Session InitializeResponse liftIO $ maybe (return ()) (putStrLn . ("Error while initializing: " ++) . show ) (initRsp ^. LSP.error) sendNotification Initialized InitializedParams diff --cc src/Language/Haskell/LSP/Test/Replay.hs index 4802c9a,2d5e4e6..dfa364b --- a/src/Language/Haskell/LSP/Test/Replay.hs +++ b/src/Language/Haskell/LSP/Test/Replay.hs @@@ -51,10 -50,14 +51,15 @@@ replaySession serverExe sessionDir = d rspSema <- newEmptyMVar passVar <- newEmptyMVar :: IO (MVar Bool) - forkIO $ runSessionWithHandler (listenServer serverMsgs requestMap reqSema rspSema passVar) serverExe sessionDir $ - sendMessages clientMsgs reqSema rspSema + threadId <- forkIO $ + runSessionWithHandler (listenServer serverMsgs requestMap reqSema rspSema passVar) ++ serverExe + sessionDir + (sendMessages clientMsgs reqSema rspSema) - takeMVar passVar + result <- takeMVar passVar + killThread threadId + return result where isClientMsg (FromClient _ _) = True diff --cc test/Test.hs index c7e6713,ca135c7..426dd6b --- a/test/Test.hs +++ b/test/Test.hs @@@ -11,10 -10,9 +10,9 @@@ import Language.Haskell.LSP.T import ParsingTests main = hspec $ do - describe "manual session validation" $ do + describe "manual session" $ do it "passes a test" $ - runSession "test/recordings/renamePass" $ do + runSession "hie" "test/recordings/renamePass" $ do doc <- openDoc "Desktop/simple.hs" "haskell" skipMany loggingNotification @@@ -39,10 -35,10 +35,10 @@@ it "fails a test" $ -- TODO: Catch the exception in haskell-lsp-test and provide nicer output - let session = runSession "test/recordings/renamePass" $ do + let session = runSession "hie" "test/recordings/renamePass" $ do openDoc "Desktop/simple.hs" "haskell" skipMany loggingNotification - request + anyRequest in session `shouldThrow` anyException describe "replay session" $ do