@@ -16,6 +16,7 @@ import Control.Lens ((^.))
16
16
17
17
#if AGPL
18
18
import qualified Data.Text.IO as T
19
+ import Test.Tasty.ExpectedFailure
19
20
#endif
20
21
21
22
tests :: TestTree
@@ -57,39 +58,44 @@ providerTests = testGroup "formatting provider" [
57
58
resp <- request STextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing )
58
59
liftIO $ resp ^. LSP. result @?= (Left $ ResponseError InvalidRequest " No plugin enabled for STextDocumentFormatting, available: []" Nothing )
59
60
60
- #if AGPL
61
+ , expectFailBecause " #1376"
62
+ $ testCase " respects initial" $ runSessionWithConfig (formatConfig " floskell" ) hlsCommand fullCaps " test/testdata/format" $ do
63
+ doc <- openDoc " Format.hs" " haskell"
64
+ formattedFloskell <- liftIO $ T. readFile " test/testdata/format/Format.floskell.formatted.hs"
65
+ formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
66
+ documentContents doc >>= liftIO . (@?= formattedFloskell)
67
+
61
68
, testCase " can change on the fly" $ runSession hlsCommand fullCaps " test/testdata/format" $ do
62
- formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.brittany .formatted.hs"
69
+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.ormolu .formatted.hs"
63
70
formattedFloskell <- liftIO $ T. readFile " test/testdata/format/Format.floskell.formatted.hs"
64
- formattedBrittanyPostFloskell <- liftIO $ T. readFile " test/testdata/format/Format.brittany_post_floskell .formatted.hs"
71
+ formattedBrittanyPostFloskell <- liftIO $ T. readFile " test/testdata/format/Format.ormolu_post_floskell .formatted.hs"
65
72
66
73
doc <- openDoc " Format.hs" " haskell"
67
74
68
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany " ))
75
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu " ))
69
76
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
70
77
documentContents doc >>= liftIO . (@?= formattedBrittany)
71
78
72
79
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " floskell" ))
73
80
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
74
81
documentContents doc >>= liftIO . (@?= formattedFloskell)
75
82
76
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany " ))
83
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu " ))
77
84
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
78
85
documentContents doc >>= liftIO . (@?= formattedBrittanyPostFloskell)
79
86
, testCase " supports both new and old configuration sections" $ runSession hlsCommand fullCaps " test/testdata/format" $ do
80
- formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.brittany .formatted.hs"
87
+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.ormolu .formatted.hs"
81
88
formattedFloskell <- liftIO $ T. readFile " test/testdata/format/Format.floskell.formatted.hs"
82
89
83
90
doc <- openDoc " Format.hs" " haskell"
84
91
85
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " brittany " ))
92
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " ormolu " ))
86
93
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
87
94
documentContents doc >>= liftIO . (@?= formattedBrittany)
88
95
89
96
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " floskell" ))
90
97
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
91
98
documentContents doc >>= liftIO . (@?= formattedFloskell)
92
- #endif
93
99
]
94
100
95
101
stylishHaskellTests :: TestTree
0 commit comments