@@ -42,11 +42,11 @@ rangeTests :: TestTree
4242rangeTests = testGroup " format range" [
4343 goldenVsStringDiff " works" goldenGitDiff " test/testdata/Format.formatted_range.hs" $ runSession hieCommand fullCaps " test/testdata" $ do
4444 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 ))
4646 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
4747 , goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/Format.formatted_range_with_tabsize.hs" $ runSession hieCommand fullCaps " test/testdata" $ do
4848 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 ))
5050 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
5151 ]
5252
@@ -143,19 +143,18 @@ brittanyTests = testGroup "brittany" [
143143 ]
144144
145145ormoluTests :: 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+ ]
159158
160159formatLspConfig :: Value -> Value
161160formatLspConfig provider = object [ " haskell" .= object [" formattingProvider" .= (provider :: Value )] ]
0 commit comments