From be754d9190918b75644157dce7d7d772fdf08b09 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Fri, 22 Jan 2021 15:10:02 +0100 Subject: [PATCH] Test apply-refact with TypeApplications (#1244) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- test/functional/FunctionalCodeAction.hs | 10 ++++++++-- test/testdata/hlint/typeapps/ApplyRefact1.hs | 3 +++ test/testdata/hlint/typeapps/hie.yaml | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/testdata/hlint/typeapps/ApplyRefact1.hs create mode 100644 test/testdata/hlint/typeapps/hie.yaml diff --git a/test/functional/FunctionalCodeAction.hs b/test/functional/FunctionalCodeAction.hs index ed99206f17..ca38bbb83a 100644 --- a/test/functional/FunctionalCodeAction.hs +++ b/test/functional/FunctionalCodeAction.hs @@ -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) @@ -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" + ] renameTests :: TestTree renameTests = testGroup "rename suggestions" [ testCase "works" $ runSession hlsCommand noLiteralCaps "test/testdata" $ do diff --git a/test/testdata/hlint/typeapps/ApplyRefact1.hs b/test/testdata/hlint/typeapps/ApplyRefact1.hs new file mode 100644 index 0000000000..78fa09aec4 --- /dev/null +++ b/test/testdata/hlint/typeapps/ApplyRefact1.hs @@ -0,0 +1,3 @@ +module ApplyRefact1 where + +a = (id @Int 1) diff --git a/test/testdata/hlint/typeapps/hie.yaml b/test/testdata/hlint/typeapps/hie.yaml new file mode 100644 index 0000000000..058382f9f0 --- /dev/null +++ b/test/testdata/hlint/typeapps/hie.yaml @@ -0,0 +1,5 @@ +cradle: + direct: + arguments: + - "-XTypeApplications" + - "ApplyRefact1"