mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-02 08:53:07 +03:00
Add PackageImport test
This commit is contained in:
parent
d859af2102
commit
2312cba385
@ -180,6 +180,30 @@ diagnosticTests = testGroup "diagnostics"
|
||||
, [(DsWarning, (2, 0), "The import of 'ModuleA' is redundant")]
|
||||
)
|
||||
]
|
||||
, testSession "package imports" $ do
|
||||
let thisDataListContent = T.unlines
|
||||
[ "module Data.List where"
|
||||
, "x = 123"
|
||||
]
|
||||
let mainContent = T.unlines
|
||||
[ "{-# LANGUAGE PackageImports #-}"
|
||||
, "module Main where"
|
||||
, "import qualified \"this\" Data.List as ThisList"
|
||||
, "import qualified \"base\" Data.List as BaseList"
|
||||
, "useThis = ThisList.x"
|
||||
, "useBase = BaseList.map"
|
||||
, "wrong1 = ThisList.map"
|
||||
, "wrong2 = BaseList.x"
|
||||
]
|
||||
_ <- openDoc' "Data/List.hs" "haskell" thisDataListContent
|
||||
_ <- openDoc' "Main.hs" "haskell" mainContent
|
||||
expectDiagnostics
|
||||
[ ( "Main.hs"
|
||||
, [(DsError, (6, 9), "Not in scope: \8216ThisList.map\8217")
|
||||
,(DsError, (7, 9), "Not in scope: \8216BaseList.x\8217")
|
||||
]
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user