@@ -29,34 +29,34 @@ import Test.Hls
29
29
main :: IO ()
30
30
main = defaultTestRunner tests
31
31
32
- evalPlugin :: PluginDescriptor IdeState
33
- evalPlugin = Eval. descriptor mempty " eval"
32
+ evalPlugin :: Recorder ( WithPriority Eval. Log ) -> PluginDescriptor IdeState
33
+ evalPlugin recorder = Eval. descriptor recorder " eval"
34
34
35
35
tests :: TestTree
36
36
tests =
37
37
testGroup " eval"
38
38
[ testCase " Produces Evaluate code lenses" $
39
- runSessionWithServer evalPlugin testDataDir $ do
39
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
40
40
doc <- openDoc " T1.hs" " haskell"
41
41
lenses <- getCodeLenses doc
42
42
liftIO $ map (preview $ command . _Just . title) lenses @?= [Just " Evaluate..." ]
43
43
, testCase " Produces Refresh code lenses" $
44
- runSessionWithServer evalPlugin testDataDir $ do
44
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
45
45
doc <- openDoc " T2.hs" " haskell"
46
46
lenses <- getCodeLenses doc
47
47
liftIO $ map (preview $ command . _Just . title) lenses @?= [Just " Refresh..." ]
48
48
, testCase " Code lenses have ranges" $
49
- runSessionWithServer evalPlugin testDataDir $ do
49
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
50
50
doc <- openDoc " T1.hs" " haskell"
51
51
lenses <- getCodeLenses doc
52
52
liftIO $ map (view range) lenses @?= [Range (Position 4 0 ) (Position 5 0 )]
53
53
, testCase " Multi-line expressions have a multi-line range" $ do
54
- runSessionWithServer evalPlugin testDataDir $ do
54
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
55
55
doc <- openDoc " T3.hs" " haskell"
56
56
lenses <- getCodeLenses doc
57
57
liftIO $ map (view range) lenses @?= [Range (Position 3 0 ) (Position 5 0 )]
58
58
, testCase " Executed expressions range covers only the expression" $ do
59
- runSessionWithServer evalPlugin testDataDir $ do
59
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
60
60
doc <- openDoc " T2.hs" " haskell"
61
61
lenses <- getCodeLenses doc
62
62
liftIO $ map (view range) lenses @?= [Range (Position 4 0 ) (Position 5 0 )]
@@ -194,7 +194,7 @@ tests =
194
194
not (" Baz Foo" `isInfixOf` output) @? " Output includes instance Baz Foo"
195
195
]
196
196
, testCase " Interfaces are reused after Eval" $ do
197
- runSessionWithServer evalPlugin testDataDir $ do
197
+ runSessionWithServerAndRecorder evalPlugin testDataDir $ do
198
198
doc <- openDoc " TLocalImport.hs" " haskell"
199
199
waitForTypecheck doc
200
200
lenses <- getCodeLenses doc
@@ -213,13 +213,13 @@ tests =
213
213
214
214
goldenWithEval :: TestName -> FilePath -> FilePath -> TestTree
215
215
goldenWithEval title path ext =
216
- goldenWithHaskellDoc evalPlugin title testDataDir path " expected" ext executeLensesBackwards
216
+ goldenWithHaskellDocAndRecorder evalPlugin title testDataDir path " expected" ext executeLensesBackwards
217
217
218
218
-- | Similar function as 'goldenWithEval' with an alternate reference file
219
219
-- naming. Useful when reference file may change because of GHC version.
220
220
goldenWithEval' :: TestName -> FilePath -> FilePath -> FilePath -> TestTree
221
221
goldenWithEval' title path ext expected =
222
- goldenWithHaskellDoc evalPlugin title testDataDir path expected ext executeLensesBackwards
222
+ goldenWithHaskellDocAndRecorder evalPlugin title testDataDir path expected ext executeLensesBackwards
223
223
224
224
-- | Execute lenses backwards, to avoid affecting their position in the source file
225
225
executeLensesBackwards :: TextDocumentIdentifier -> Session ()
@@ -246,7 +246,7 @@ executeCmd cmd = do
246
246
pure ()
247
247
248
248
evalLenses :: FilePath -> IO [CodeLens ]
249
- evalLenses path = runSessionWithServer evalPlugin testDataDir $ do
249
+ evalLenses path = runSessionWithServerAndRecorder evalPlugin testDataDir $ do
250
250
doc <- openDoc path " haskell"
251
251
executeLensesBackwards doc
252
252
getCodeLenses doc
@@ -280,12 +280,12 @@ exceptionConfig exCfg = changeConfig ["exception" .= exCfg]
280
280
281
281
goldenWithEvalConfig' :: TestName -> FilePath -> FilePath -> FilePath -> Config -> TestTree
282
282
goldenWithEvalConfig' title path ext expected cfg =
283
- goldenWithHaskellDoc evalPlugin title testDataDir path expected ext $ \ doc -> do
283
+ goldenWithHaskellDocAndRecorder evalPlugin title testDataDir path expected ext $ \ doc -> do
284
284
sendConfigurationChanged (toJSON cfg)
285
285
executeLensesBackwards doc
286
286
287
287
evalInFile :: HasCallStack => FilePath -> T. Text -> T. Text -> IO ()
288
- evalInFile fp e expected = runSessionWithServer evalPlugin testDataDir $ do
288
+ evalInFile fp e expected = runSessionWithServerAndRecorder evalPlugin testDataDir $ do
289
289
doc <- openDoc fp " haskell"
290
290
origin <- documentContents doc
291
291
let withEval = origin <> e
0 commit comments