Skip to content

Commit 1dace14

Browse files
committed
Test apply-refact preserve comments
1 parent 0fecd88 commit 1dace14

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

test/functional/FunctionalCodeAction.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ hlintTests = testGroup "hlint suggestions" [
157157
testCase "hlint diagnostics ignore hints honouring HLINT annotations" $ runHlintSession "" $ do
158158
doc <- openDoc "ApplyRefact5.hs" "haskell"
159159
expectNoMoreDiagnostics 3 doc "hlint"
160+
161+
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
162+
testRefactor "ApplyRefact6.hs" "Redundant bracket" expectedComments
160163
]
161164
where
162165
runHlintSession :: FilePath -> Session a -> IO a
@@ -191,6 +194,14 @@ hlintTests = testGroup "hlint suggestions" [
191194
, "g = 2"
192195
, "#endif", ""
193196
]
197+
expectedComments = [ "-- comment before header"
198+
, "module ApplyRefact6 where", ""
199+
, "{-# standalone annotation #-}", ""
200+
, "-- standalone comment", ""
201+
, "-- | haddock comment"
202+
, "f = {- inline comment -} 1 -- ending comment", ""
203+
, "-- final comment"
204+
]
194205

195206
renameTests :: TestTree
196207
renameTests = testGroup "rename suggestions" [

test/testdata/hlint/ApplyRefact6.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- comment before header
2+
module ApplyRefact6 where
3+
4+
{-# standalone annotation #-}
5+
6+
-- standalone comment
7+
8+
-- | haddock comment
9+
f = {- inline comment -} (1) -- ending comment
10+
11+
-- final comment

test/testdata/hlint/hie.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ cradle:
88
- "ApplyRefact3"
99
- "ApplyRefact4"
1010
- "ApplyRefact5"
11+
- "ApplyRefact6"

0 commit comments

Comments
 (0)