Skip to content

Commit 1d568f1

Browse files
committed
Fix func test
1 parent f25d071 commit 1d568f1

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ test-suite func-test
520520
import: common-deps
521521
, warnings
522522
, pedantic
523+
, refactor
523524
type: exitcode-stdio-1.0
524525
default-language: Haskell2010
525526
build-tool-depends:

test/functional/Format.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ providerTests = testGroup "formatting provider" [
4747
testCase "respects none" $ runSessionWithConfig (formatConfig "none") hlsCommand fullCaps "test/testdata/format" $ do
4848
doc <- openDoc "Format.hs" "haskell"
4949
resp <- request STextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing)
50-
liftIO $ resp ^. LSP.result @?= Left (ResponseError InvalidRequest
51-
("No plugin enabled for STextDocumentFormatting, available:\n"
52-
<> "PluginId \"floskell\"\nPluginId \"fourmolu\"\nPluginId \"stylish-haskell\"\nPluginId \"brittany\"\nPluginId \"ormolu\"\n")
53-
Nothing)
50+
case resp ^. LSP.result of
51+
result@(Left (ResponseError reason message Nothing)) -> case reason of
52+
MethodNotFound -> pure () -- No formatter
53+
InvalidRequest | "No plugin enabled for STextDocumentFormatting" `isPrefixOf` message -> pure ()
54+
_ -> assertFailure $ "strange response from formatting provider:" ++ show result
55+
result -> assertFailure $ "strange response from formatting provider:" ++ show result
56+
5457

5558
, requiresOrmoluPlugin . requiresFloskellPlugin $ testCase "can change on the fly" $ runSession hlsCommand fullCaps "test/testdata/format" $ do
5659
formattedOrmolu <- liftIO $ T.readFile "test/testdata/format/Format.ormolu.formatted.hs"

test/functional/FunctionalCodeAction.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ import Test.Hls.Command
2424

2525
tests :: TestTree
2626
tests = testGroup "code actions" [
27+
#if hls_refactor
2728
importTests
2829
, packageTests
2930
, redundantImportTests
3031
, renameTests
3132
, signatureTests
3233
, typedHoleTests
3334
, unusedTermTests
35+
#endif
3436
]
3537

3638
renameTests :: TestTree

0 commit comments

Comments
 (0)