Skip to content

Test apply-refact with TypeApplications #1244

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 2 commits into from
Jan 22, 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
10 changes: 8 additions & 2 deletions test/functional/FunctionalCodeAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,14 @@ hlintTests = testGroup "hlint suggestions" [
doc <- openDoc "ApplyRefact2.hs" "haskell"
testHlintDiagnostics doc

, testCase "apply-refact works with LambdaCase via ghc -XLambdaCase argument (#590)" $ runHlintSession "lambdacase" $ do
, testCase "apply-refact works with -XLambdaCase argument (#590)" $ runHlintSession "lambdacase" $ do
testRefactor "ApplyRefact1.hs" "Redundant bracket"
expectedLambdaCase

, testCase "apply-refact works with -XTypeApplications argument (#1242)" $ runHlintSession "typeapps" $ do
testRefactor "ApplyRefact1.hs" "Redundant bracket"
expectedTypeApp

, testCase "apply hints works with LambdaCase via language pragma" $ runHlintSession "" $ do
testRefactor "ApplyRefact1.hs" "Redundant bracket"
("{-# LANGUAGE LambdaCase #-}" : expectedLambdaCase)
Expand Down Expand Up @@ -206,7 +210,9 @@ hlintTests = testGroup "hlint suggestions" [
, "f = {- inline comment -}{- inline comment inside refactored code -} 1 -- ending comment", ""
, "-- final comment"
]

expectedTypeApp = [ "module ApplyRefact1 where", ""
, "a = id @Int 1"
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change these tests to golden tests? If it sounds good, I'm willing to update it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i was thinking in do it in the past. But otoh i suspect they will not change frequently and to have them close to the code has its value imo.
that said we are using golden tests in other tests and to be consistent is good too, so that change will welcomed, thanks!

renameTests :: TestTree
renameTests = testGroup "rename suggestions" [
testCase "works" $ runSession hlsCommand noLiteralCaps "test/testdata" $ do
Expand Down
3 changes: 3 additions & 0 deletions test/testdata/hlint/typeapps/ApplyRefact1.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module ApplyRefact1 where

a = (id @Int 1)
5 changes: 5 additions & 0 deletions test/testdata/hlint/typeapps/hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cradle:
direct:
arguments:
- "-XTypeApplications"
- "ApplyRefact1"