Skip to content

Commit 2157ff5

Browse files
committed
Execute Eval tests sequentially
1 parent 226ba3f commit 2157ff5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: test/functional/Eval.hs

+16-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Control.Monad.IO.Class (MonadIO (liftIO))
1414
import qualified Data.Text as T
1515
import qualified Data.Text.IO as T
1616
import Language.Haskell.LSP.Test (
17+
Session,
1718
anyMessage,
1819
documentContents,
1920
executeCommand,
@@ -166,8 +167,13 @@ goldenTestBy f input = runSession hlsCommand fullCaps evalPath $ do
166167
codeLenses <- reverse . filter f <$> getCodeLenses doc
167168
-- liftIO $ print codeLenses
168169

169-
mapM_ executeCommand $ [c | CodeLens{_command = Just c} <- codeLenses]
170-
_resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
170+
-- Execute in parallel
171+
-- mapM_ executeCommand $ [c | CodeLens{_command = Just c} <- codeLenses]
172+
-- _resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
173+
174+
-- Execute sequentially
175+
mapM_ executeCmd $ [c | CodeLens{_command = Just c} <- codeLenses]
176+
171177
edited <- replaceUnicodeQuotes <$> documentContents doc
172178
-- liftIO $ T.putStrLn edited
173179

@@ -181,6 +187,14 @@ goldenTestBy f input = runSession hlsCommand fullCaps evalPath $ do
181187
expected <- liftIO $ T.readFile expectedFile
182188
liftIO $ edited @?= expected
183189

190+
-- Execute command and wait for result
191+
executeCmd :: Command -> Session ()
192+
executeCmd cmd = do
193+
executeCommand cmd
194+
_resp :: ApplyWorkspaceEditRequest <- skipManyTill anyMessage message
195+
-- liftIO $ print _resp
196+
return ()
197+
184198
-- Execute only Eval tests to avoid interference from other plugins (e.g ghcide:typesignature.add)
185199
isEvalTest :: CodeLens -> Bool
186200
isEvalTest (CodeLens _ (Just (Command _ cmd _)) _)

0 commit comments

Comments
 (0)