@@ -57,39 +57,43 @@ providerTests = testGroup "formatting provider" [
57
57
resp <- request STextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing )
58
58
liftIO $ resp ^. LSP. result @?= (Left $ ResponseError InvalidRequest " No plugin enabled for STextDocumentFormatting, available: []" Nothing )
59
59
60
- #if AGPL
60
+ , testCase " respects initial" $ runSessionWithConfig (formatConfig " floskell" ) hlsCommand fullCaps " test/testdata/format" $ do
61
+ doc <- openDoc " Format.hs" " haskell"
62
+ formattedFloskell <- liftIO $ T. readFile " test/testdata/format/Format.floskell.initial.hs"
63
+ formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
64
+ documentContents doc >>= liftIO . (@?= formattedFloskell)
65
+
61
66
, 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"
67
+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.ormolu .formatted.hs"
63
68
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"
69
+ formattedBrittanyPostFloskell <- liftIO $ T. readFile " test/testdata/format/Format.ormolu_post_floskell .formatted.hs"
65
70
66
71
doc <- openDoc " Format.hs" " haskell"
67
72
68
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany " ))
73
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu " ))
69
74
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
70
75
documentContents doc >>= liftIO . (@?= formattedBrittany)
71
76
72
77
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " floskell" ))
73
78
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
74
79
documentContents doc >>= liftIO . (@?= formattedFloskell)
75
80
76
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany " ))
81
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu " ))
77
82
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
78
83
documentContents doc >>= liftIO . (@?= formattedBrittanyPostFloskell)
79
84
, 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"
85
+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/Format.ormolu .formatted.hs"
81
86
formattedFloskell <- liftIO $ T. readFile " test/testdata/format/Format.floskell.formatted.hs"
82
87
83
88
doc <- openDoc " Format.hs" " haskell"
84
89
85
- sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " brittany " ))
90
+ sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " ormolu " ))
86
91
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
87
92
documentContents doc >>= liftIO . (@?= formattedBrittany)
88
93
89
94
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld " floskell" ))
90
95
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing )
91
96
documentContents doc >>= liftIO . (@?= formattedFloskell)
92
- #endif
93
97
]
94
98
95
99
stylishHaskellTests :: TestTree
0 commit comments