@@ -656,6 +656,34 @@ removeImportTests = testGroup "remove import actions"
656
656
, " main = print A.stuffB"
657
657
]
658
658
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
659
687
]
660
688
661
689
importRenameActionTests :: TestTree
0 commit comments