Skip to content

Commit

Permalink
Test apply-refact preserve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jneira committed Dec 23, 2020
1 parent 1526f90 commit 1c56e0e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/functional/FunctionalCodeAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ hlintTests = testGroup "hlint suggestions" [
testCase "hlint diagnostics ignore hints honouring HLINT annotations" $ runHlintSession "" $ do
doc <- openDoc "ApplyRefact5.hs" "haskell"
expectNoMoreDiagnostics 3 doc "hlint"

, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
testRefactor "ApplyRefact6.hs" "Redundant bracket" expectedComments
]
where
runHlintSession :: FilePath -> Session a -> IO a
Expand Down Expand Up @@ -193,6 +196,14 @@ hlintTests = testGroup "hlint suggestions" [
, "g = 2"
, "#endif", ""
]
expectedComments = [ "-- comment before header"
, "module ApplyRefact6 where", ""
, "{-# standalone annotation #-}", ""
, "-- standalone comment", ""
, "-- | haddock comment"
, "f = {- inline comment -} 1 -- ending comment", ""
, "-- final comment"
]

renameTests :: TestTree
renameTests = testGroup "rename suggestions" [
Expand Down
11 changes: 11 additions & 0 deletions test/testdata/hlint/ApplyRefact6.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- comment before header
module ApplyRefact6 where

{-# standalone annotation #-}

-- standalone comment

-- | haddock comment
f = {- inline comment -} (1) -- ending comment

-- final comment
1 change: 1 addition & 0 deletions test/testdata/hlint/hie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ cradle:
- "ApplyRefact3"
- "ApplyRefact4"
- "ApplyRefact5"
- "ApplyRefact6"

0 comments on commit 1c56e0e

Please sign in to comment.