Skip to content

[skip circleci] Rename hlint test data files and add regression tests #2321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add reproduction for #2290
  • Loading branch information
jneira committed Nov 5, 2021
commit ebd9445ca5d33f722a4cf7946fcbe04d30b9d97a
6 changes: 6 additions & 0 deletions plugins/hls-hlint-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ suggestionsTests =
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
testRefactor "Comments.hs" "Redundant bracket" expectedComments

, testCase "[#2290] apply all hints works with a trailing comment" $ runHlintSession "" $ do
testRefactor "TwoHintsAndComment.hs" "Apply all hints" expectedComments2

, testCase "applyAll is shown only when there is at least one diagnostic in range" $ runHlintSession "" $ do
doc <- openDoc "TwoHints.hs" "haskell"
_ <- waitForDiagnosticsFromSource doc "hlint"
Expand Down Expand Up @@ -212,6 +215,9 @@ suggestionsTests =
, "f = {- inline comment -}{- inline comment inside refactored code -} 1 -- ending comment", ""
, "-- final comment"
]
expectedComments2 = [ "module TwoHintsAndComment where"
, "biggest items = foldr1 max -- the line above will show two hlint hints, \"eta reduce\" and \"use maximum\""
]
expectedTypeApp = [ "module TypeApplication where", ""
, "a = id @Int 1"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module TwoHintsAndComments where

biggest items = foldr1 max items -- the line above will show two hlint hints, "eta reduce" and "use maximum"
1 change: 1 addition & 0 deletions plugins/hls-hlint-plugin/test/testdata/hie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cradle:
- "TwoHints"
- "PatternKeyword"
- "StrictData"
- "TwoHintsAndComment"