on master help sign in
jjk (#300)
commit6bb1e4e05a894e9b34471808f475313f88dab55d authorPepe Iborra <pepeiborra@gmail.com> dateThu 2 Jan 2020, 16:31 (7 years ago) parent5ca06a1
1 file changed+28
test/exe/Main.hs+28
test/exe/Main.hs+28
@@ -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
661689importRenameActionTests :: TestTree