Skip to content

Commit 6bb1e4e

Browse files
pepeiborraaherrmann-da
authored andcommitted
jjk (#300)
1 parent 5ca06a1 commit 6bb1e4e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/exe/Main.hs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,34 @@ removeImportTests = testGroup "remove import actions"
656656
, "main = print A.stuffB"
657657
]
658658
liftIO $ expectedContentAfterAction @=? contentAfterAction
659+
, (`xfail` "known broken (#299)") $ testSession "redundant hierarchical import" $ do
660+
let contentA = T.unlines
661+
[ "module ModuleA where"
662+
, "data A = A"
663+
, "stuffB :: Integer"
664+
, "stuffB = 123"
665+
]
666+
_docA <- openDoc' "ModuleA.hs" "haskell" contentA
667+
let contentB = T.unlines
668+
[ "{-# OPTIONS_GHC -Wunused-imports #-}"
669+
, "module ModuleB where"
670+
, "import ModuleA (A(..), stuffB)"
671+
, "main = print stuffB"
672+
]
673+
docB <- openDoc' "ModuleB.hs" "haskell" contentB
674+
_ <- waitForDiagnostics
675+
[CACodeAction action@CodeAction { _title = actionTitle }]
676+
<- getCodeActions docB (Range (Position 2 0) (Position 2 5))
677+
liftIO $ "Remove A from import" @=? actionTitle
678+
executeCodeAction action
679+
contentAfterAction <- documentContents docB
680+
let expectedContentAfterAction = T.unlines
681+
[ "{-# OPTIONS_GHC -Wunused-imports #-}"
682+
, "module ModuleB where"
683+
, "import ModuleA (stuffB)"
684+
, "main = print stuffB"
685+
]
686+
liftIO $ expectedContentAfterAction @=? contentAfterAction
659687
]
660688

661689
importRenameActionTests :: TestTree

0 commit comments

Comments
 (0)