Skip to content

test: repro for #2662: extend import list miss separator #2664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,36 @@ extendImportTests = testGroup "extend import actions"
, "import ModuleA as A (stuffB, (.*))"
, "main = print (stuffB .* stuffB)"
])
, knownBrokenForGhcVersions [GHC92] "missing comma. #2662" $ testSession "extend single line import with infix constructor" $ template
[]
("ModuleB.hs", T.unlines
[ "module ModuleB where"
, "import Data.List.NonEmpty (fromList)"
, "main = case (fromList []) of _ :| _ -> pure ()"
])
(Range (Position 2 5) (Position 2 6))
["Add NonEmpty((:|)) to the import list of Data.List.NonEmpty"]
(T.unlines
[ "module ModuleB where"
, "import Data.List.NonEmpty (fromList, NonEmpty ((:|)))"
, "main = case (fromList []) of _ :| _ -> pure ()"
])
, knownBrokenForGhcVersions [GHC92] "missing comma. #2662" $ testSession "extend single line import with prefix constructor" $ template
[]
("ModuleB.hs", T.unlines
[ "module ModuleB where"
, "import Prelude hiding (Maybe(..))"
, "import Data.Maybe (catMaybes)"
, "x = Just 10"
])
(Range (Position 3 5) (Position 2 6))
["Add Maybe(Just) to the import list of Data.Maybe"]
(T.unlines
[ "module ModuleB where"
, "import Prelude hiding (Maybe(..))"
, "import Data.Maybe (catMaybes, Maybe (Just))"
, "x = Just 10"
])
, testSession "extend single line import with type" $ template
[("ModuleA.hs", T.unlines
[ "module ModuleA where"
Expand Down