@@ -213,6 +213,7 @@ codeActionTests = testGroup "code actions"
213213 [ renameActionTests
214214 , typeWildCardActionTests
215215 , removeImportTests
216+ , importRenameActionTests
216217 ]
217218
218219renameActionTests :: TestTree
@@ -413,6 +414,27 @@ removeImportTests = testGroup "remove import actions"
413414 liftIO $ expectedContentAfterAction @=? contentAfterAction
414415 ]
415416
417+importRenameActionTests :: TestTree
418+importRenameActionTests = testGroup "import rename actions"
419+ [ testSession "Data.Mape -> Data.Map" $ check "Map"
420+ , testSession "Data.Mape -> Data.Maybe" $ check "Maybe" ] where
421+ check modname = do
422+ let content = T.unlines
423+ [ "module Testing where"
424+ , "import Data.Mape"
425+ ]
426+ doc <- openDoc' "Testing.hs" "haskell" content
427+ _ <- waitForDiagnostics
428+ actionsOrCommands <- getCodeActions doc (Range (Position 2 8) (Position 2 16))
429+ let [changeToMap] = [action | CACodeAction action@CodeAction{ _title = actionTitle } <- actionsOrCommands, ("Data." <> modname) `T.isInfixOf` actionTitle ]
430+ executeCodeAction changeToMap
431+ contentAfterAction <- documentContents doc
432+ let expectedContentAfterAction = T.unlines
433+ [ "module Testing where"
434+ , "import Data." <> modname
435+ ]
436+ liftIO $ expectedContentAfterAction @=? contentAfterAction
437+
416438----------------------------------------------------------------------
417439-- Utils
418440