Skip to content

Commit b616aa5

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

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-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/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)