Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 16ce3d2

Browse files
committed
Fix test with interleaved diagnostics
1 parent 3c52b4e commit 16ce3d2

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

test/functional/FunctionalLiquidSpec.hs

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,31 @@ spec :: Spec
2121
spec = describe "liquid haskell diagnostics" $ do
2222
it "runs diagnostics on save, no liquid" $
2323
runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
24-
-- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
2524
doc <- openDoc "liquid/Evens.hs" "haskell"
2625

2726
diags@(reduceDiag:_) <- waitForDiagnostics
2827

29-
-- liftIO $ show diags `shouldBe` ""
30-
-- liftIO $ putStrLn "a"
31-
3228
liftIO $ do
3329
length diags `shouldBe` 2
3430
reduceDiag ^. range `shouldBe` Range (Position 5 18) (Position 5 22)
3531
reduceDiag ^. severity `shouldBe` Just DsHint
3632
reduceDiag ^. code `shouldBe` Just (StringValue "Use negate")
3733
reduceDiag ^. source `shouldBe` Just "hlint"
3834

39-
-- liftIO $ putStrLn "b"
40-
4135
diags2hlint <- waitForDiagnostics
42-
-- liftIO $ putStrLn "c"
43-
-- liftIO $ show diags2hlint `shouldBe` ""
36+
4437
liftIO $ length diags2hlint `shouldBe` 2
4538

46-
-- docItem <- getDocItem file languageId
4739
sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc)
4840

49-
-- diags2liquid <- waitForDiagnostics
50-
-- liftIO $ putStrLn "d"
51-
-- liftIO $ length diags2liquid `shouldBe` 3
52-
-- -- liftIO $ show diags2liquid `shouldBe` ""
53-
54-
diags3@(d:_) <- waitForDiagnostics
55-
-- liftIO $ putStrLn "e"
56-
-- liftIO $ show diags3 `shouldBe` ""
41+
diags3@(d:_) <- waitForDiagnosticsSource "eg2"
42+
5743
liftIO $ do
58-
length diags3 `shouldBe` 3
59-
d ^. range `shouldBe` Range (Position 0 0) (Position 1 0)
60-
d ^. severity `shouldBe` Nothing
61-
d ^. code `shouldBe` Nothing
62-
d ^. source `shouldBe` Just "eg2"
63-
d ^. message `shouldBe` (T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave")
44+
length diags3 `shouldBe` 1
45+
d ^. LSP.range `shouldBe` Range (Position 0 0) (Position 1 0)
46+
d ^. LSP.severity `shouldBe` Nothing
47+
d ^. LSP.code `shouldBe` Nothing
48+
d ^. LSP.message `shouldBe` T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave"
6449

6550
-- ---------------------------------
6651

0 commit comments

Comments
 (0)