Skip to content

Commit 019a6e0

Browse files
committed
Multi component test suite: replace delays with waits
1 parent b88cbf9 commit 019a6e0

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

ghcide/test/exe/Main.hs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5484,12 +5484,10 @@ simpleMultiTest :: TestTree
54845484
simpleMultiTest = testCase "simple-multi-test" $ withLongTimeout $ runWithExtraFiles "multi" $ \dir -> do
54855485
let aPath = dir </> "a/A.hs"
54865486
bPath = dir </> "b/B.hs"
5487-
aSource <- liftIO $ readFileUtf8 aPath
5488-
adoc <- createDoc aPath "haskell" aSource
5487+
adoc <- openDoc aPath "haskell"
5488+
bdoc <- openDoc bPath "haskell"
54895489
WaitForIdeRuleResult {..} <- waitForAction "TypeCheck" adoc
54905490
liftIO $ assertBool "A should typecheck" ideResultSuccess
5491-
bSource <- liftIO $ readFileUtf8 bPath
5492-
bdoc <- createDoc bPath "haskell" bSource
54935491
WaitForIdeRuleResult {..} <- waitForAction "TypeCheck" bdoc
54945492
liftIO $ assertBool "B should typecheck" ideResultSuccess
54955493
locs <- getDefinitions bdoc (Position 2 7)
@@ -5502,15 +5500,14 @@ simpleMultiTest2 :: TestTree
55025500
simpleMultiTest2 = testCase "simple-multi-test2" $ runWithExtraFiles "multi" $ \dir -> do
55035501
let aPath = dir </> "a/A.hs"
55045502
bPath = dir </> "b/B.hs"
5505-
bSource <- liftIO $ readFileUtf8 bPath
5506-
bdoc <- createDoc bPath "haskell" bSource
5507-
expectNoMoreDiagnostics 10
5508-
aSource <- liftIO $ readFileUtf8 aPath
5509-
(TextDocumentIdentifier adoc) <- createDoc aPath "haskell" aSource
5510-
-- Need to have some delay here or the test fails
5511-
expectNoMoreDiagnostics 10
5503+
bdoc <- openDoc bPath "haskell"
5504+
WaitForIdeRuleResult {} <- waitForAction "TypeCheck" bdoc
5505+
adoc@(TextDocumentIdentifier auri) <- openDoc aPath "haskell"
5506+
WaitForIdeRuleResult {} <- waitForAction "TypeCheck" adoc
55125507
locs <- getDefinitions bdoc (Position 2 7)
5513-
let fooL = mkL adoc 2 0 2 3
5508+
let fooL = mkL auri 2 0 2 3
5509+
checkDefs locs (pure [fooL])
5510+
expectNoMoreDiagnostics 0.5
55145511
checkDefs locs (pure [fooL])
55155512
expectNoMoreDiagnostics 0.5
55165513

0 commit comments

Comments
 (0)