Skip to content

Commit 1c56e0e

Browse files
committed
Test apply-refact preserve comments
1 parent 1526f90 commit 1c56e0e

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
@@ -155,6 +155,9 @@ hlintTests = testGroup "hlint suggestions" [
155155
testCase "hlint diagnostics ignore hints honouring HLINT annotations" $ runHlintSession "" $ do
156156
doc <- openDoc "ApplyRefact5.hs" "haskell"
157157
expectNoMoreDiagnostics 3 doc "hlint"
158+
159+
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
160+
testRefactor "ApplyRefact6.hs" "Redundant bracket" expectedComments
158161
]
159162
where
160163
runHlintSession :: FilePath -> Session a -> IO a
@@ -193,6 +196,14 @@ hlintTests = testGroup "hlint suggestions" [
193196
, "g = 2"
194197
, "#endif", ""
195198
]
199+
expectedComments = [ "-- comment before header"
200+
, "module ApplyRefact6 where", ""
201+
, "{-# standalone annotation #-}", ""
202+
, "-- standalone comment", ""
203+
, "-- | haddock comment"
204+
, "f = {- inline comment -} 1 -- ending comment", ""
205+
, "-- final comment"
206+
]
196207

197208
renameTests :: TestTree
198209
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)