Skip to content

Commit d573c7a

Browse files
committed
Add more tests for ormolu
1 parent 99ba3d3 commit d573c7a

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

test/functional/Format.hs

+8-3
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,18 @@ brittanyTests = testGroup "brittany" [
143143
]
144144

145145
ormoluTests :: TestTree
146-
ormoluTests = testGroup "ormolu" [
147-
goldenVsStringDiff "formats correctly" goldenGitDiff ("test/testdata/Format.ormolu." ++ ormoluGoldenSuffix ++ ".hs") $ runSession hieCommand fullCaps "test/testdata" $ do
146+
ormoluTests = testGroup "ormolu"
147+
[ goldenVsStringDiff "formats correctly" goldenGitDiff ("test/testdata/Format.ormolu." ++ ormoluGoldenSuffix ++ ".hs") $ runSession hieCommand fullCaps "test/testdata" $ do
148148
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu"))
149149
doc <- openDoc "Format.hs" "haskell"
150150
formatDoc doc (FormattingOptions 2 True)
151151
BS.fromStrict . T.encodeUtf8 <$> documentContents doc
152-
]
152+
, goldenVsStringDiff "sorts imports correctly" goldenGitDiff ("test/testdata/Format2.ormolu." ++ ormoluGoldenSuffix ++ ".hs") $ runSession hieCommand fullCaps "test/testdata" $ do
153+
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig "ormolu"))
154+
doc <- openDoc "Format2.hs" "haskell"
155+
formatDoc doc (FormattingOptions 2 True)
156+
BS.fromStrict . T.encodeUtf8 <$> documentContents doc
157+
]
153158
where
154159
ormoluGoldenSuffix = case ghcVersion of
155160
GHC88 -> "formatted"

test/testdata/Format2.hs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Data.Char
2+
import Data.Either
3+
import Data.Int
4+
import Data.Data
5+
import Data.Bool
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Data.Bool
2+
import Data.Char
3+
import Data.Data
4+
import Data.Either
5+
import Data.Int
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Data.Char
2+
import Data.Either
3+
import Data.Int
4+
import Data.Data
5+
import Data.Bool

0 commit comments

Comments
 (0)