Skip to content

Commit 675ec23

Browse files
committed
Restore missing hlint test
1 parent 7f37579 commit 675ec23

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/functional/FunctionalCodeAction.hs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,32 @@ hlintTests = testGroup "hlint suggestions" [
9696

9797
liftIO $ Just "hlint" `notElem` map (^. L.source) diags' @? "There are no hlint diagnostics"
9898

99+
, testCase "changing document contents updates hlint diagnostics" $ runSession hlsCommand fullCaps "test/testdata/hlint" $ do
100+
doc <- openDoc "ApplyRefact2.hs" "haskell"
101+
diags <- waitForDiagnosticsSource "hlint"
102+
103+
liftIO $ length diags @?= 2 -- "Eta Reduce" and "Redundant Id"
104+
105+
let change = TextDocumentContentChangeEvent
106+
(Just (Range (Position 1 8) (Position 1 12)))
107+
Nothing "x"
108+
109+
changeDoc doc [change]
110+
111+
diags' <- waitForDiagnostics
112+
113+
liftIO $ (not $ Just "hlint" `elem` map (^. L.source) diags') @? "There are no hlint diagnostics"
114+
115+
let change' = TextDocumentContentChangeEvent
116+
(Just (Range (Position 1 8) (Position 1 12)))
117+
Nothing "id x"
118+
119+
changeDoc doc [change']
120+
121+
diags'' <- waitForDiagnosticsSource "hlint"
122+
123+
liftIO $ length diags'' @?= 2
124+
99125
, testCase "apply hints works with LambdaCase" $ runSession hlsCommand fullCaps "test/testdata/hlint" $ do
100126
doc <- openDoc "ApplyRefact1.hs" "haskell"
101127
diags <- waitForDiagnosticsSource "hlint"

0 commit comments

Comments
 (0)