Skip to content

Commit b4c8d6a

Browse files
committed
Restore missing hlint test
1 parent ca5f69d commit b4c8d6a

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
@@ -98,6 +98,32 @@ hlintTests = testGroup "hlint suggestions" [
9898

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

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

0 commit comments

Comments
 (0)