Skip to content

Commit 9cd1fdd

Browse files
guiboujneira
andauthored
test: repro for #2662: extend import list miss separator (#2664)
* test: repro for #2662: extend import list miss separator * test: Add test for import list extension with prefix ctor * test: Mark failing test explicitly with GHC 9.2 They are failing because of #2662. * test: use knownBrokenForGhcVersions instead of ignoreForGHC92 The first one will fail once the test is fixed. Co-authored-by: Javier Neira <[email protected]>
1 parent df21896 commit 9cd1fdd

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ghcide/test/exe/Main.hs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,36 @@ extendImportTests = testGroup "extend import actions"
15201520
, "import ModuleA as A (stuffB, (.*))"
15211521
, "main = print (stuffB .* stuffB)"
15221522
])
1523+
, knownBrokenForGhcVersions [GHC92] "missing comma. #2662" $ testSession "extend single line import with infix constructor" $ template
1524+
[]
1525+
("ModuleB.hs", T.unlines
1526+
[ "module ModuleB where"
1527+
, "import Data.List.NonEmpty (fromList)"
1528+
, "main = case (fromList []) of _ :| _ -> pure ()"
1529+
])
1530+
(Range (Position 2 5) (Position 2 6))
1531+
["Add NonEmpty((:|)) to the import list of Data.List.NonEmpty"]
1532+
(T.unlines
1533+
[ "module ModuleB where"
1534+
, "import Data.List.NonEmpty (fromList, NonEmpty ((:|)))"
1535+
, "main = case (fromList []) of _ :| _ -> pure ()"
1536+
])
1537+
, knownBrokenForGhcVersions [GHC92] "missing comma. #2662" $ testSession "extend single line import with prefix constructor" $ template
1538+
[]
1539+
("ModuleB.hs", T.unlines
1540+
[ "module ModuleB where"
1541+
, "import Prelude hiding (Maybe(..))"
1542+
, "import Data.Maybe (catMaybes)"
1543+
, "x = Just 10"
1544+
])
1545+
(Range (Position 3 5) (Position 2 6))
1546+
["Add Maybe(Just) to the import list of Data.Maybe"]
1547+
(T.unlines
1548+
[ "module ModuleB where"
1549+
, "import Prelude hiding (Maybe(..))"
1550+
, "import Data.Maybe (catMaybes, Maybe (Just))"
1551+
, "x = Just 10"
1552+
])
15231553
, testSession "extend single line import with type" $ template
15241554
[("ModuleA.hs", T.unlines
15251555
[ "module ModuleA where"

0 commit comments

Comments
 (0)