Skip to content

Commit bace426

Browse files
committed
unignore tests for cross-module renames
1 parent 866d6f5 commit bace426

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

plugins/hls-rename-plugin/hls-rename-plugin.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ test-suite tests
4646
main-is: Main.hs
4747
ghc-options: -threaded -rtsopts -with-rtsopts=-N
4848
build-depends:
49+
, aeson
4950
, base
51+
, containers
5052
, filepath
53+
, hls-plugin-api
5154
, hls-rename-plugin
5255
, hls-test-utils ^>=1.2

plugins/hls-rename-plugin/test/Main.hs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
module Main (main) where
44

5+
import Data.Aeson
6+
import qualified Data.Map as M
7+
import Ide.Plugin.Config
58
import qualified Ide.Plugin.Rename as Rename
69
import System.FilePath
710
import Test.Hls
@@ -14,54 +17,51 @@ renamePlugin = Rename.descriptor "rename"
1417

1518
tests :: TestTree
1619
tests = testGroup "Rename"
17-
[ goldenWithRename "Data constructor" "DataConstructor" $ \doc -> do
20+
[ goldenWithRename "Data constructor" "DataConstructor" $ \doc ->
1821
rename doc (Position 0 15) "Op"
19-
, ignoreTestBecause "Renaming across modules unsupported" $
20-
goldenWithRename "Exported function" "ExportedFunction" $ \doc -> do
22+
, goldenWithRename "Exported function" "ExportedFunction" $ \doc ->
2123
rename doc (Position 2 1) "quux"
22-
, goldenWithRename "Function argument" "FunctionArgument" $ \doc -> do
24+
, goldenWithRename "Function argument" "FunctionArgument" $ \doc ->
2325
rename doc (Position 3 4) "y"
24-
, goldenWithRename "Function name" "FunctionName" $ \doc -> do
26+
, goldenWithRename "Function name" "FunctionName" $ \doc ->
2527
rename doc (Position 3 1) "baz"
26-
, goldenWithRename "GADT" "Gadt" $ \doc -> do
28+
, goldenWithRename "GADT" "Gadt" $ \doc ->
2729
rename doc (Position 6 37) "Expr"
28-
, ignoreTestBecause "Renaming across modules unsupported" $
29-
goldenWithRename "Hidden function" "HiddenFunction" $ \doc -> do
30+
, goldenWithRename "Hidden function" "HiddenFunction" $ \doc ->
3031
rename doc (Position 0 32) "quux"
31-
, ignoreTestBecause "Renaming across modules unsupported" $
32-
goldenWithRename "Imported function" "ImportedFunction" $ \doc -> do
32+
, goldenWithRename "Imported function" "ImportedFunction" $ \doc ->
3333
rename doc (Position 3 8) "baz"
34-
, ignoreTestBecause "Renaming across modules unsupported" $
35-
goldenWithRename "Import hiding" "ImportHiding" $ \doc -> do
34+
, goldenWithRename "Import hiding" "ImportHiding" $ \doc ->
3635
rename doc (Position 0 22) "hiddenFoo"
37-
, goldenWithRename "Let expression" "LetExpression" $ \doc -> do
36+
, goldenWithRename "Let expression" "LetExpression" $ \doc ->
3837
rename doc (Position 5 11) "foobar"
39-
, ignoreTestBecause "Renaming across modules unsupported" $
40-
goldenWithRename "Qualified as" "QualifiedAs" $ \doc -> do
38+
, goldenWithRename "Qualified as" "QualifiedAs" $ \doc ->
4139
rename doc (Position 3 10) "baz"
42-
, ignoreTestBecause "Renaming across modules unsupported" $
43-
goldenWithRename "Qualified shadowing" "QualifiedShadowing" $ \doc -> do
40+
, goldenWithRename "Qualified shadowing" "QualifiedShadowing" $ \doc ->
4441
rename doc (Position 3 12) "foobar"
45-
, ignoreTestBecause "Renaming across modules unsupported" $
46-
goldenWithRename "Qualified function" "QualifiedFunction" $ \doc -> do
42+
, goldenWithRename "Qualified function" "QualifiedFunction" $ \doc ->
4743
rename doc (Position 3 12) "baz"
48-
, goldenWithRename "Realigns do block indentation" "RealignDo" $ \doc -> do
44+
, goldenWithRename "Realigns do block indentation" "RealignDo" $ \doc ->
4945
rename doc (Position 0 2) "fooBarQuux"
50-
, goldenWithRename "Record field" "RecordField" $ \doc -> do
46+
, goldenWithRename "Record field" "RecordField" $ \doc ->
5147
rename doc (Position 6 9) "number"
52-
, goldenWithRename "Shadowed name" "ShadowedName" $ \doc -> do
48+
, goldenWithRename "Shadowed name" "ShadowedName" $ \doc ->
5349
rename doc (Position 1 1) "baz"
54-
, goldenWithRename "Typeclass" "Typeclass" $ \doc -> do
50+
, goldenWithRename "Typeclass" "Typeclass" $ \doc ->
5551
rename doc (Position 8 15) "Equal"
56-
, goldenWithRename "Type constructor" "TypeConstructor" $ \doc -> do
52+
, goldenWithRename "Type constructor" "TypeConstructor" $ \doc ->
5753
rename doc (Position 2 17) "BinaryTree"
58-
, goldenWithRename "Type variable" "TypeVariable" $ \doc -> do
54+
, goldenWithRename "Type variable" "TypeVariable" $ \doc ->
5955
rename doc (Position 0 13) "b"
6056
]
6157

62-
goldenWithRename :: TestName -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
63-
goldenWithRename title path =
64-
goldenWithHaskellDoc renamePlugin title testDataDir path "expected" "hs"
58+
goldenWithRename :: TestName-> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
59+
goldenWithRename title path act =
60+
goldenWithHaskellDoc renamePlugin title testDataDir path "expected" "hs" $ \doc -> do
61+
sendConfigurationChanged $ toJSON $
62+
def { plugins = M.fromList [("rename", def { plcConfig = "crossModule" .= True })] }
63+
act doc
64+
6565

6666
testDataDir :: FilePath
6767
testDataDir = "test" </> "testdata"

0 commit comments

Comments
 (0)