File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ tests = testGroup "format document" [
30
30
, stylishHaskellTests
31
31
, brittanyTests
32
32
, ormoluTests
33
+ , fourmoluTests
33
34
]
34
35
35
36
rangeTests :: TestTree
@@ -127,6 +128,17 @@ ormoluTests = testGroup "ormolu" [
127
128
GHC86 -> " formatted"
128
129
_ -> " unchanged"
129
130
131
+ fourmoluTests :: TestTree
132
+ fourmoluTests = testGroup " fourmolu" [
133
+ goldenVsStringDiff " formats correctly" goldenGitDiff (" test/testdata/Format.fourmolu.hs" ) $ runSession hieCommand fullCaps " test/testdata" $ do
134
+ let formatLspConfig provider =
135
+ object [ " languageServerHaskell" .= object [" formattingProvider" .= (provider :: Value )] ]
136
+ sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " fourmolu" ))
137
+ doc <- openDoc " Format.hs" " haskell"
138
+ formatDoc doc (FormattingOptions 4 True )
139
+ BS. fromStrict . T. encodeUtf8 <$> documentContents doc
140
+ ]
141
+
130
142
131
143
formatLspConfig :: Value -> Value
132
144
formatLspConfig provider = object [ " languageServerHaskell" .= object [" formattingProvider" .= (provider :: Value )] ]
Original file line number Diff line number Diff line change
1
+ module Format where
2
+
3
+ foo :: Int -> Int
4
+ foo 3 = 2
5
+ foo x = x
6
+ bar :: String -> IO String
7
+ bar s = do
8
+ x <- return " hello"
9
+ return " asdf"
10
+
11
+ data Baz = Baz { a :: Int , b :: String }
12
+
You can’t perform that action at this time.
0 commit comments