@@ -18,11 +18,11 @@ import qualified Data.Text.IO as T
18
18
19
19
tests :: TestTree
20
20
tests = 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
22
22
doc <- openDoc " Format.hs" " haskell"
23
23
formatDoc doc (FormattingOptions 2 True )
24
24
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
26
26
doc <- openDoc " Format.hs" " haskell"
27
27
formatDoc doc (FormattingOptions 5 True )
28
28
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
@@ -38,19 +38,19 @@ tests = testGroup "format document" [
38
38
39
39
rangeTests :: TestTree
40
40
rangeTests = 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
42
42
doc <- openDoc " Format.hs" " haskell"
43
43
formatRange doc (FormattingOptions 2 True ) (Range (Position 5 0 ) (Position 7 10 ))
44
44
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
46
46
doc <- openDoc " Format.hs" " haskell"
47
47
formatRange doc (FormattingOptions 5 True ) (Range (Position 8 0 ) (Position 11 19 ))
48
48
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
49
49
]
50
50
51
51
providerTests :: TestTree
52
52
providerTests = 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
54
54
doc <- openDoc " Format.hs" " haskell"
55
55
orig <- documentContents doc
56
56
@@ -61,10 +61,10 @@ providerTests = testGroup "formatting provider" [
61
61
documentContents doc >>= liftIO . (@?= orig)
62
62
63
63
#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"
68
68
69
69
doc <- openDoc " Format.hs" " haskell"
70
70
@@ -79,9 +79,9 @@ providerTests = testGroup "formatting provider" [
79
79
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
80
80
formatDoc doc (FormattingOptions 2 True )
81
81
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"
85
85
86
86
doc <- openDoc " Format.hs" " haskell"
87
87
@@ -97,12 +97,12 @@ providerTests = testGroup "formatting provider" [
97
97
98
98
stylishHaskellTests :: TestTree
99
99
stylishHaskellTests = 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
101
101
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " stylish-haskell" ))
102
102
doc <- openDoc " StylishHaskell.hs" " haskell"
103
103
formatDoc doc (FormattingOptions 2 True )
104
104
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
106
106
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " stylish-haskell" ))
107
107
doc <- openDoc " StylishHaskell.hs" " haskell"
108
108
formatRange doc (FormattingOptions 2 True ) (Range (Position 0 0 ) (Position 2 21 ))
@@ -112,26 +112,26 @@ stylishHaskellTests = testGroup "stylish-haskell" [
112
112
#if AGPL
113
113
brittanyTests :: TestTree
114
114
brittanyTests = 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
116
116
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
117
117
doc <- openDoc " BrittanyLF.hs" " haskell"
118
118
formatDoc doc (FormattingOptions 4 True )
119
119
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
120
120
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
122
122
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
123
123
doc <- openDoc " BrittanyCRLF.hs" " haskell"
124
124
formatDoc doc (FormattingOptions 4 True )
125
125
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
126
126
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
128
128
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
129
129
doc <- openDoc " BrittanyLF.hs" " haskell"
130
130
let range = Range (Position 1 0 ) (Position 2 22 )
131
131
formatRange doc (FormattingOptions 4 True ) range
132
132
BS. fromStrict . T. encodeUtf8 <$> documentContents doc
133
133
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
135
135
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " brittany" ))
136
136
doc <- openDoc " BrittanyCRLF.hs" " haskell"
137
137
let range = Range (Position 1 0 ) (Position 2 22 )
@@ -142,12 +142,12 @@ brittanyTests = testGroup "brittany" [
142
142
143
143
ormoluTests :: TestTree
144
144
ormoluTests = 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
146
146
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
147
147
doc <- openDoc " Format.hs" " haskell"
148
148
formatDoc doc (FormattingOptions 2 True )
149
149
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
151
151
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " ormolu" ))
152
152
doc <- openDoc " Format2.hs" " haskell"
153
153
formatDoc doc (FormattingOptions 2 True )
@@ -156,12 +156,12 @@ ormoluTests = testGroup "ormolu"
156
156
157
157
fourmoluTests :: TestTree
158
158
fourmoluTests = 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
160
160
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " fourmolu" ))
161
161
doc <- openDoc " Format.hs" " haskell"
162
162
formatDoc doc (FormattingOptions 4 True )
163
163
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
165
165
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (formatLspConfig " fourmolu" ))
166
166
doc <- openDoc " Format2.hs" " haskell"
167
167
formatDoc doc (FormattingOptions 4 True )
0 commit comments