@@ -24,6 +24,7 @@ tests = testGroup "format document" [
2424 documentContents doc >>= liftIO . (`shouldBe` formattedDocTabSize5)
2525 , rangeTests
2626 , providerTests
27+ , stylishHaskellTests
2728 , brittanyTests
2829 , ormoluTests
2930 ]
@@ -68,6 +69,16 @@ providerTests = testGroup "formatting provider" [
6869 documentContents doc >>= liftIO . (`shouldBe` formattedBrittanyPostFloskell)
6970 ]
7071
72+ stylishHaskellTests :: TestTree
73+ stylishHaskellTests = testGroup " stylish-haskell" [
74+ testCase " formats a file" $ runSession hieCommand fullCaps " test/testdata" $ do
75+ sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " stylish-haskell" ))
76+ doc <- openDoc " StylishHaskell.hs" " haskell"
77+ formatDoc doc (FormattingOptions 2 True )
78+ contents <- documentContents doc
79+ liftIO $ contents `shouldBe` formattedStylishHaskell
80+ ]
81+
7182brittanyTests :: TestTree
7283brittanyTests = testGroup " brittany" [
7384 ignoreTestBecause " Broken" $ testCase " formats a document with LF endings" $ runSession hieCommand fullCaps " test/testdata" $ do
@@ -175,6 +186,18 @@ formattedRangeTabSize5 =
175186 \\n \
176187 \data Baz = Baz { a :: Int, b :: String }\n\n "
177188
189+ formattedStylishHaskell :: T. Text
190+ formattedStylishHaskell =
191+ " import Data.Char\n \
192+ \import qualified Data.List\n \
193+ \import Data.String\n \
194+ \\n \
195+ \bar :: Maybe (Either String Integer) -> Integer\n \
196+ \bar Nothing = 0\n \
197+ \bar (Just (Left _)) = 0\n \
198+ \bar (Just (Right x)) = x\n \
199+ \"
200+
178201formattedFloskell :: T. Text
179202formattedFloskell =
180203 " module Format where\n \
0 commit comments