@@ -42,11 +42,11 @@ rangeTests :: TestTree
42
42
rangeTests = testGroup " format range" [
43
43
goldenVsStringDiff " works" goldenGitDiff " test/testdata/Format.formatted_range.hs" $ runSession hieCommand fullCaps " test/testdata" $ do
44
44
doc <- openDoc " Format.hs" " haskell"
45
- formatRange doc (FormattingOptions 2 True ) (Range (Position 1 0 ) (Position 3 10 ))
45
+ formatRange doc (FormattingOptions 2 True ) (Range (Position 5 0 ) (Position 7 10 ))
46
46
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
47
47
, goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/Format.formatted_range_with_tabsize.hs" $ runSession hieCommand fullCaps " test/testdata" $ do
48
48
doc <- openDoc " Format.hs" " haskell"
49
- formatRange doc (FormattingOptions 5 True ) (Range (Position 4 0 ) (Position 7 19 ))
49
+ formatRange doc (FormattingOptions 5 True ) (Range (Position 8 0 ) (Position 11 19 ))
50
50
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
51
51
]
52
52
@@ -143,19 +143,18 @@ brittanyTests = testGroup "brittany" [
143
143
]
144
144
145
145
ormoluTests :: TestTree
146
- ormoluTests = testGroup " ormolu" [
147
- goldenVsStringDiff " formats correctly" goldenGitDiff (" test/testdata/Format.ormolu." ++ ormoluGoldenSuffix ++ " .hs" ) $ runSession hieCommand fullCaps " test/testdata" $ do
148
- sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
149
- doc <- openDoc " Format.hs" " haskell"
150
- formatDoc doc (FormattingOptions 2 True )
151
- BS. fromStrict . T. encodeUtf8 <$> documentContents doc
152
- ]
153
- where
154
- ormoluGoldenSuffix = case ghcVersion of
155
- GHC88 -> " formatted"
156
- GHC86 -> " formatted"
157
- _ -> " unchanged"
158
-
146
+ ormoluTests = testGroup " ormolu"
147
+ [ goldenVsStringDiff " formats correctly" goldenGitDiff " test/testdata/Format.ormolu.formatted.hs" $ runSession hieCommand fullCaps " test/testdata" $ do
148
+ sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
149
+ doc <- openDoc " Format.hs" " haskell"
150
+ formatDoc doc (FormattingOptions 2 True )
151
+ BS. fromStrict . T. encodeUtf8 <$> documentContents doc
152
+ , goldenVsStringDiff " formats imports correctly" goldenGitDiff " test/testdata/Format2.ormolu.formatted.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
+ ]
159
158
160
159
formatLspConfig :: Value -> Value
161
160
formatLspConfig provider = object [ " haskell" .= object [" formattingProvider" .= (provider :: Value )] ]
0 commit comments