@@ -18,11 +18,11 @@ import qualified Data.Text.IO as T
1818
1919tests :: TestTree
2020tests = testGroup " format document" [
21- goldenVsStringDiff " works" goldenGitDiff " test/testdata/Format.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
21+ goldenVsStringDiff " works" goldenGitDiff " test/testdata/format/ Format.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
2222 doc <- openDoc " Format.hs" " haskell"
2323 formatDoc doc (FormattingOptions 2 True )
2424 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
25- , goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
25+ , goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/format/ Format.formatted_document_with_tabsize.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
2626 doc <- openDoc " Format.hs" " haskell"
2727 formatDoc doc (FormattingOptions 5 True )
2828 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
@@ -38,19 +38,19 @@ tests = testGroup "format document" [
3838
3939rangeTests :: TestTree
4040rangeTests = testGroup " format range" [
41- goldenVsStringDiff " works" goldenGitDiff " test/testdata/Format.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
41+ goldenVsStringDiff " works" goldenGitDiff " test/testdata/format/ Format.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
4242 doc <- openDoc " Format.hs" " haskell"
4343 formatRange doc (FormattingOptions 2 True ) (Range (Position 5 0 ) (Position 7 10 ))
4444 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
45- , goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
45+ , goldenVsStringDiff " works with custom tab size" goldenGitDiff " test/testdata/format/ Format.formatted_range_with_tabsize.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
4646 doc <- openDoc " Format.hs" " haskell"
4747 formatRange doc (FormattingOptions 5 True ) (Range (Position 8 0 ) (Position 11 19 ))
4848 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
4949 ]
5050
5151providerTests :: TestTree
5252providerTests = testGroup " formatting provider" [
53- testCase " respects none" $ runSessionWithConfig (formatConfig " none" ) hlsCommand fullCaps " test/testdata" $ do
53+ testCase " respects none" $ runSessionWithConfig (formatConfig " none" ) hlsCommand fullCaps " test/testdata/format " $ do
5454 doc <- openDoc " Format.hs" " haskell"
5555 orig <- documentContents doc
5656
@@ -61,10 +61,10 @@ providerTests = testGroup "formatting provider" [
6161 documentContents doc >>= liftIO . (@?= orig)
6262
6363#if AGPL
64- , testCase " can change on the fly" $ runSession hlsCommand fullCaps " test/testdata" $ do
65- formattedBrittany <- liftIO $ T. readFile " test/testdata/Format.brittany.formatted.hs"
66- formattedFloskell <- liftIO $ T. readFile " test/testdata/Format.floskell.formatted.hs"
67- formattedBrittanyPostFloskell <- liftIO $ T. readFile " test/testdata/Format.brittany_post_floskell.formatted.hs"
64+ , testCase " can change on the fly" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
65+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/ Format.brittany.formatted.hs"
66+ formattedFloskell <- liftIO $ T. readFile " test/testdata/format/ Format.floskell.formatted.hs"
67+ formattedBrittanyPostFloskell <- liftIO $ T. readFile " test/testdata/format/ Format.brittany_post_floskell.formatted.hs"
6868
6969 doc <- openDoc " Format.hs" " haskell"
7070
@@ -79,9 +79,9 @@ providerTests = testGroup "formatting provider" [
7979 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
8080 formatDoc doc (FormattingOptions 2 True )
8181 documentContents doc >>= liftIO . (@?= formattedBrittanyPostFloskell)
82- , testCase " supports both new and old configuration sections" $ runSession hlsCommand fullCaps " test/testdata" $ do
83- formattedBrittany <- liftIO $ T. readFile " test/testdata/Format.brittany.formatted.hs"
84- formattedFloskell <- liftIO $ T. readFile " test/testdata/Format.floskell.formatted.hs"
82+ , testCase " supports both new and old configuration sections" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
83+ formattedBrittany <- liftIO $ T. readFile " test/testdata/format/ Format.brittany.formatted.hs"
84+ formattedFloskell <- liftIO $ T. readFile " test/testdata/format/ Format.floskell.formatted.hs"
8585
8686 doc <- openDoc " Format.hs" " haskell"
8787
@@ -97,12 +97,12 @@ providerTests = testGroup "formatting provider" [
9797
9898stylishHaskellTests :: TestTree
9999stylishHaskellTests = testGroup " stylish-haskell" [
100- goldenVsStringDiff " formats a document" goldenGitDiff " test/testdata/StylishHaksell .formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
100+ goldenVsStringDiff " formats a document" goldenGitDiff " test/testdata/format/StylishHaskell .formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
101101 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " stylish-haskell" ))
102102 doc <- openDoc " StylishHaskell.hs" " haskell"
103103 formatDoc doc (FormattingOptions 2 True )
104104 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
105- , goldenVsStringDiff " formats a range" goldenGitDiff " test/testdata/StylishHaksell .formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
105+ , goldenVsStringDiff " formats a range" goldenGitDiff " test/testdata/format/StylishHaskell .formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
106106 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " stylish-haskell" ))
107107 doc <- openDoc " StylishHaskell.hs" " haskell"
108108 formatRange doc (FormattingOptions 2 True ) (Range (Position 0 0 ) (Position 2 21 ))
@@ -112,26 +112,26 @@ stylishHaskellTests = testGroup "stylish-haskell" [
112112#if AGPL
113113brittanyTests :: TestTree
114114brittanyTests = testGroup " brittany" [
115- goldenVsStringDiff " formats a document with LF endings" goldenGitDiff " test/testdata/BrittanyLF.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
115+ goldenVsStringDiff " formats a document with LF endings" goldenGitDiff " test/testdata/format/ BrittanyLF.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
116116 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
117117 doc <- openDoc " BrittanyLF.hs" " haskell"
118118 formatDoc doc (FormattingOptions 4 True )
119119 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
120120
121- , goldenVsStringDiff " formats a document with CRLF endings" goldenGitDiff " test/testdata/BrittanyCRLF.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
121+ , goldenVsStringDiff " formats a document with CRLF endings" goldenGitDiff " test/testdata/format/ BrittanyCRLF.formatted_document.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
122122 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
123123 doc <- openDoc " BrittanyCRLF.hs" " haskell"
124124 formatDoc doc (FormattingOptions 4 True )
125125 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
126126
127- , goldenVsStringDiff " formats a range with LF endings" goldenGitDiff " test/testdata/BrittanyLF.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
127+ , goldenVsStringDiff " formats a range with LF endings" goldenGitDiff " test/testdata/format/ BrittanyLF.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
128128 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
129129 doc <- openDoc " BrittanyLF.hs" " haskell"
130130 let range = Range (Position 1 0 ) (Position 2 22 )
131131 formatRange doc (FormattingOptions 4 True ) range
132132 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
133133
134- , goldenVsStringDiff " formats a range with CRLF endings" goldenGitDiff " test/testdata/BrittanyCRLF.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
134+ , goldenVsStringDiff " formats a range with CRLF endings" goldenGitDiff " test/testdata/format/ BrittanyCRLF.formatted_range.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
135135 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
136136 doc <- openDoc " BrittanyCRLF.hs" " haskell"
137137 let range = Range (Position 1 0 ) (Position 2 22 )
@@ -142,12 +142,12 @@ brittanyTests = testGroup "brittany" [
142142
143143ormoluTests :: TestTree
144144ormoluTests = testGroup " ormolu"
145- [ goldenVsStringDiff " formats correctly" goldenGitDiff " test/testdata/Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
145+ [ goldenVsStringDiff " formats correctly" goldenGitDiff " test/testdata/format/ Format.ormolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
146146 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
147147 doc <- openDoc " Format.hs" " haskell"
148148 formatDoc doc (FormattingOptions 2 True )
149149 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
150- , goldenVsStringDiff " formats imports correctly" goldenGitDiff " test/testdata/Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
150+ , goldenVsStringDiff " formats imports correctly" goldenGitDiff " test/testdata/format/ Format2.ormolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
151151 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
152152 doc <- openDoc " Format2.hs" " haskell"
153153 formatDoc doc (FormattingOptions 2 True )
@@ -156,12 +156,12 @@ ormoluTests = testGroup "ormolu"
156156
157157fourmoluTests :: TestTree
158158fourmoluTests = testGroup " fourmolu"
159- [ goldenVsStringDiff " formats correctly" goldenGitDiff " test/testdata/Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
159+ [ goldenVsStringDiff " formats correctly" goldenGitDiff " test/testdata/format/ Format.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
160160 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " fourmolu" ))
161161 doc <- openDoc " Format.hs" " haskell"
162162 formatDoc doc (FormattingOptions 4 True )
163163 BS. fromStrict . T. encodeUtf8 <$> documentContents doc
164- , goldenVsStringDiff " formats imports correctly" goldenGitDiff " test/testdata/Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata" $ do
164+ , goldenVsStringDiff " formats imports correctly" goldenGitDiff " test/testdata/format/ Format2.fourmolu.formatted.hs" $ runSession hlsCommand fullCaps " test/testdata/format " $ do
165165 sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " fourmolu" ))
166166 doc <- openDoc " Format2.hs" " haskell"
167167 formatDoc doc (FormattingOptions 4 True )
0 commit comments