@@ -17,8 +17,9 @@ import TestUtils (getSupportModuleNames)
1717
1818completionTests :: Spec
1919completionTests = context " completionTests" $ do
20- mns <- runIO $ getSupportModuleNames
21- mapM_ assertCompletedOk (completionTestData mns)
20+ mns <- runIO getSupportModuleNames
21+ psciState <- runIO getPSCiStateForCompletion
22+ mapM_ (assertCompletedOk psciState) (completionTestData mns)
2223
2324-- If the cursor is at the right end of the line, with the 1st element of the
2425-- pair as the text in the line, then pressing tab should offer all the
@@ -87,16 +88,14 @@ completionTestData supportModuleNames =
8788 , (" Control.Monad.Eff.Class." , [] )
8889 ]
8990
90- assertCompletedOk :: (String , [String ]) -> Spec
91- assertCompletedOk (line, expecteds) = specify line $ do
92- results <- runCM (completion' (reverse line, " " ))
91+ assertCompletedOk :: PSCiState -> (String , [String ]) -> Spec
92+ assertCompletedOk psciState (line, expecteds) = specify line $ do
93+ results <- runCM psciState (completion' (reverse line, " " ))
9394 let actuals = formatCompletions results
9495 sort actuals `shouldBe` sort expecteds
9596
96- runCM :: CompletionM a -> IO a
97- runCM act = do
98- psciState <- getPSCiStateForCompletion
99- evalStateT (liftCompletionM act) psciState
97+ runCM :: PSCiState -> CompletionM a -> IO a
98+ runCM psciState act = evalStateT (liftCompletionM act) psciState
10099
101100getPSCiStateForCompletion :: IO PSCiState
102101getPSCiStateForCompletion = do
0 commit comments