Skip to content

Commit 2312cba

Browse files
committed
Add PackageImport test
1 parent d859af2 commit 2312cba

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/exe/Main.hs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,30 @@ diagnosticTests = testGroup "diagnostics"
180180
, [(DsWarning, (2, 0), "The import of 'ModuleA' is redundant")]
181181
)
182182
]
183+
, testSession "package imports" $ do
184+
let thisDataListContent = T.unlines
185+
[ "module Data.List where"
186+
, "x = 123"
187+
]
188+
let mainContent = T.unlines
189+
[ "{-# LANGUAGE PackageImports #-}"
190+
, "module Main where"
191+
, "import qualified \"this\" Data.List as ThisList"
192+
, "import qualified \"base\" Data.List as BaseList"
193+
, "useThis = ThisList.x"
194+
, "useBase = BaseList.map"
195+
, "wrong1 = ThisList.map"
196+
, "wrong2 = BaseList.x"
197+
]
198+
_ <- openDoc' "Data/List.hs" "haskell" thisDataListContent
199+
_ <- openDoc' "Main.hs" "haskell" mainContent
200+
expectDiagnostics
201+
[ ( "Main.hs"
202+
, [(DsError, (6, 9), "Not in scope: \8216ThisList.map\8217")
203+
,(DsError, (7, 9), "Not in scope: \8216BaseList.x\8217")
204+
]
205+
)
206+
]
183207
]
184208

185209

0 commit comments

Comments
 (0)