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

Commit 1bf711f

Browse files
committed
Add test for window/progress
1 parent cb32ff9 commit 1bf711f

12 files changed

+69
-12
lines changed

haskell-ide-engine.cabal

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ test-suite func-test
263263
, HaReSpec
264264
, HighlightSpec
265265
, HoverSpec
266+
, ProgressSpec
266267
, ReferencesSpec
267268
, RenameSpec
268269
, SymbolsSpec
@@ -275,9 +276,9 @@ test-suite func-test
275276
, data-default
276277
, directory
277278
, filepath
278-
, lsp-test >= 0.5.1.1 && < 0.5.2
279+
, lsp-test >= 0.5.1.3
279280
, haskell-ide-engine
280-
, haskell-lsp-types
281+
, haskell-lsp-types == 0.10.*
281282
, hie-test-utils
282283
, hie-plugin-api
283284
, hspec

stack-8.2.1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extra-deps:
2323
- haskell-lsp-types-0.10.0.0
2424
- hlint-2.0.11
2525
- hsimport-0.8.6
26-
- lsp-test-0.5.1.1
26+
- lsp-test-0.5.1.3
2727
- monad-dijkstra-0.1.1.2
2828
- mtl-2.2.2
2929
- pretty-show-1.8.2

stack-8.2.2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extra-deps:
2727
- hlint-2.1.16
2828
- hoogle-5.0.17.6
2929
- hsimport-0.8.8
30-
- lsp-test-0.5.1.1
30+
- lsp-test-0.5.1.3
3131
- monad-dijkstra-0.1.1.2
3232
- pretty-show-1.8.2
3333
- sorted-list-0.2.1.0

stack-8.4.2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extra-deps:
2525
- hlint-2.1.16
2626
- hoogle-5.0.17.6
2727
- hsimport-0.8.8
28-
- lsp-test-0.5.1.1
28+
- lsp-test-0.5.1.3
2929
- monad-dijkstra-0.1.1.2
3030
- pretty-show-1.8.2
3131
- syz-0.2.0.0

stack-8.4.3.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extra-deps:
2424
- hlint-2.1.16
2525
- hoogle-5.0.17.6
2626
- hsimport-0.8.8
27-
- lsp-test-0.5.1.1
27+
- lsp-test-0.5.1.3
2828
- monad-dijkstra-0.1.1.2
2929
- pretty-show-1.8.2
3030
- syz-0.2.0.0

stack-8.4.4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extra-deps:
2424
- hlint-2.1.16
2525
- hoogle-5.0.17.6
2626
- hsimport-0.8.8
27-
- lsp-test-0.5.1.1
27+
- lsp-test-0.5.1.3
2828
- monad-dijkstra-0.1.1.2
2929
- optparse-simple-0.1.0
3030
- pretty-show-1.9.5

stack-8.6.1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extra-deps:
2626
- hlint-2.1.16
2727
- hoogle-5.0.17.6
2828
- hsimport-0.8.8
29-
- lsp-test-0.5.1.1
29+
- lsp-test-0.5.1.3
3030
- monad-dijkstra-0.1.1.2
3131
- monad-memo-0.4.1
3232
- monoid-subclasses-0.4.6.1

stack-8.6.2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extra-deps:
2222
- hlint-2.1.16
2323
- hoogle-5.0.17.6
2424
- hsimport-0.8.8
25-
- lsp-test-0.5.1.1
25+
- lsp-test-0.5.1.3
2626
- monad-dijkstra-0.1.1.2
2727
- monad-memo-0.4.1
2828
- multistate-0.8.0.1

stack-8.6.3.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extra-deps:
2222
- hlint-2.1.16
2323
- hoogle-5.0.17.6
2424
- hsimport-0.8.8
25-
- lsp-test-0.5.1.1
25+
- lsp-test-0.5.1.3
2626
- monad-dijkstra-0.1.1.2
2727
- monad-memo-0.4.1
2828
- multistate-0.8.0.1

stack-8.6.4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extra-deps:
2222
- hlint-2.1.16
2323
- hoogle-5.0.17.6
2424
- hsimport-0.8.8
25-
- lsp-test-0.5.1.1
25+
- lsp-test-0.5.1.3
2626
- monad-dijkstra-0.1.1.2@rev:1
2727
- monad-memo-0.4.1
2828
- multistate-0.8.0.1

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extra-deps:
2323
- haskell-src-exts-util-0.2.5
2424
- hlint-2.1.16
2525
- hsimport-0.8.8
26-
- lsp-test-0.5.1.1
26+
- lsp-test-0.5.1.3
2727
- monad-dijkstra-0.1.1.2@rev:1
2828
- monad-memo-0.4.1
2929
- multistate-0.8.0.1

test/functional/ProgressSpec.hs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
module ProgressSpec where
3+
4+
import Control.Applicative.Combinators
5+
import Control.Lens
6+
import Control.Monad.IO.Class
7+
import Language.Haskell.LSP.Test
8+
import Language.Haskell.LSP.Types
9+
import qualified Language.Haskell.LSP.Types.Lens as L
10+
import Language.Haskell.LSP.Types.Capabilities
11+
import Test.Hspec
12+
import TestUtils
13+
14+
spec :: Spec
15+
spec = describe "window/progress" $
16+
it "sends indefinite progress notifications" $
17+
-- Testing that ghc-mod sends progress notifications
18+
runSession hieCommand progressCaps "test/testdata" $ do
19+
doc <- openDoc "ApplyRefact2.hs" "haskell"
20+
21+
skipMany loggingNotification
22+
23+
-- Initial hlint notifications
24+
_ <- publishDiagnosticsNotification
25+
26+
startNotification <- message :: Session ProgressStartNotification
27+
liftIO $ do
28+
startNotification ^. L.params . L.title `shouldBe` "Typechecking ApplyRefact2.hs"
29+
startNotification ^. L.params . L.id `shouldBe` "0"
30+
31+
doneNotification <- message :: Session ProgressDoneNotification
32+
liftIO $ doneNotification ^. L.params . L.id `shouldBe` "0"
33+
34+
-- the ghc-mod diagnostics
35+
_ <- publishDiagnosticsNotification
36+
37+
-- Test incrementing ids
38+
sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc)
39+
40+
-- hlint notifications
41+
_ <- publishDiagnosticsNotification
42+
43+
startNotification' <- message :: Session ProgressStartNotification
44+
liftIO $ do
45+
startNotification' ^. L.params . L.title `shouldBe` "Typechecking ApplyRefact2.hs"
46+
startNotification' ^. L.params . L.id `shouldBe` "1"
47+
48+
doneNotification' <- message :: Session ProgressDoneNotification
49+
liftIO $ doneNotification' ^. L.params . L.id `shouldBe` "1"
50+
51+
-- the ghc-mod diagnostics
52+
const () <$> publishDiagnosticsNotification
53+
54+
55+
progressCaps :: ClientCapabilities
56+
progressCaps = fullCaps { _window = Just (WindowClientCapabilities (Just True)) }

0 commit comments

Comments
 (0)