Skip to content

Commit c65fbd2

Browse files
committed
Add a test for #1376
1 parent f96125f commit c65fbd2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/functional/Format.hs

+12-8
Original file line numberDiff line numberDiff line change
@@ -57,39 +57,43 @@ providerTests = testGroup "formatting provider" [
5757
resp <- request STextDocumentFormatting $ DocumentFormattingParams Nothing doc (FormattingOptions 2 True Nothing Nothing Nothing)
5858
liftIO $ resp ^. LSP.result @?= (Left $ ResponseError InvalidRequest "No plugin enabled for STextDocumentFormatting, available: []" Nothing)
5959

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+
6166
, 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"
6368
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"
6570

6671
doc <- openDoc "Format.hs" "haskell"
6772

68-
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany"))
73+
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu"))
6974
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing)
7075
documentContents doc >>= liftIO . (@?= formattedBrittany)
7176

7277
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "floskell"))
7378
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing)
7479
documentContents doc >>= liftIO . (@?= formattedFloskell)
7580

76-
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "brittany"))
81+
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu"))
7782
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing)
7883
documentContents doc >>= liftIO . (@?= formattedBrittanyPostFloskell)
7984
, 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"
8186
formattedFloskell <- liftIO $ T.readFile "test/testdata/format/Format.floskell.formatted.hs"
8287

8388
doc <- openDoc "Format.hs" "haskell"
8489

85-
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld "brittany"))
90+
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld "ormolu"))
8691
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing)
8792
documentContents doc >>= liftIO . (@?= formattedBrittany)
8893

8994
sendNotification SWorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfigOld "floskell"))
9095
formatDoc doc (FormattingOptions 2 True Nothing Nothing Nothing)
9196
documentContents doc >>= liftIO . (@?= formattedFloskell)
92-
#endif
9397
]
9498

9599
stylishHaskellTests :: TestTree

0 commit comments

Comments
 (0)