Skip to content

Commit 0e0a492

Browse files
committed
Put tests back
1 parent b995ad6 commit 0e0a492

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

test/functional/Progress.hs

+28-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ module Progress (tests) where
99
import Control.Exception (throw)
1010
import Control.Lens hiding ((.=))
1111
import Data.Aeson (decode, encode)
12+
import Data.Functor (void)
1213
import Data.List (delete)
1314
import Data.Maybe (fromJust)
14-
import Data.Text (Text)
15+
import Data.Text (Text, pack)
16+
import Ide.Types
1517
import Language.LSP.Protocol.Capabilities
1618
import qualified Language.LSP.Protocol.Lens as L
1719
import Test.Hls
@@ -23,7 +25,12 @@ tests :: TestTree
2325
tests =
2426
testGroup
2527
"window/workDoneProgress"
26-
[ requiresEvalPlugin $ testCase "eval plugin sends progress reports" $
28+
[ testCase "sends indefinite progress notifications" $
29+
runSession hlsLspCommand progressCaps "test/testdata/diagnostics" $ do
30+
let path = "Foo.hs"
31+
_ <- openDoc path "haskell"
32+
expectProgressMessages [pack ("Setting up diagnostics (for " ++ path ++ ")"), "Processing", "Indexing"] [] []
33+
, requiresEvalPlugin $ testCase "eval plugin sends progress reports" $
2734
runSession hlsLspCommand progressCaps "plugins/hls-eval-plugin/test/testdata" $ do
2835
doc <- openDoc "TIO.hs" "haskell"
2936
lspId <- sendRequest SMethod_TextDocumentCodeLens (CodeLensParams Nothing Nothing doc)
@@ -48,8 +55,27 @@ tests =
4855

4956
expectProgressMessages ["Evaluating"] createdProgressTokens activeProgressTokens
5057
_ -> error $ "Unexpected response result: " ++ show response
58+
, requiresOrmoluPlugin $ testCase "ormolu plugin sends progress notifications" $ do
59+
runSessionWithConfig (def { ignoreConfigurationRequests = False }) hlsLspCommand progressCaps "test/testdata/format" $ do
60+
void configurationRequest
61+
setHlsConfig (formatLspConfig "ormolu")
62+
doc <- openDoc "Format.hs" "haskell"
63+
expectProgressMessages ["Setting up format (for Format.hs)", "Processing", "Indexing"] [] []
64+
_ <- sendRequest SMethod_TextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing)
65+
expectProgressMessages ["Formatting Format.hs"] [] []
66+
, requiresFourmoluPlugin $ testCase "fourmolu plugin sends progress notifications" $ do
67+
runSessionWithConfig (def { ignoreConfigurationRequests = False }) hlsLspCommand progressCaps "test/testdata/format" $ do
68+
void configurationRequest
69+
setHlsConfig (formatLspConfig "fourmolu")
70+
doc <- openDoc "Format.hs" "haskell"
71+
expectProgressMessages ["Setting up format (for Format.hs)", "Processing", "Indexing"] [] []
72+
_ <- sendRequest SMethod_TextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing)
73+
expectProgressMessages ["Formatting Format.hs"] [] []
5174
]
5275

76+
formatLspConfig :: Text -> Config
77+
formatLspConfig provider = def { formattingProvider = provider }
78+
5379
progressCaps :: ClientCapabilities
5480
progressCaps = fullCaps{_window = Just (WindowClientCapabilities (Just True) Nothing Nothing)}
5581

test/utils/Test/Hls/Command.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ hlsExeCommand = unsafePerformIO $ do
2222
pure testExe
2323

2424
hlsLspCommand :: String
25-
hlsLspCommand = hlsExeCommand ++ " --lsp -d -j4"
25+
hlsLspCommand = hlsExeCommand ++ " --lsp --test -d -j4"
2626

2727
hlsWrapperLspCommand :: String
28-
hlsWrapperLspCommand = hlsWrapperExeCommand ++ " --lsp -d -j4"
28+
hlsWrapperLspCommand = hlsWrapperExeCommand ++ " --lsp --test -d -j4"
2929

3030
hlsWrapperExeCommand :: String
3131
{-# NOINLINE hlsWrapperExeCommand #-}

0 commit comments

Comments
 (0)