Skip to content

Commit e4a3e44

Browse files
committed
Add failing test case
1 parent f0c1646 commit e4a3e44

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ghcide/test/exe/DiagnosticTests.hs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,34 @@ tests = testGroup "diagnostics"
232232
_ <- createDoc "ModuleB.hs" "haskell" contentB
233233
_ <- createDoc "ModuleB.hs-boot" "haskell" contentBboot
234234
expectDiagnostics [("ModuleB.hs", [(DiagnosticSeverity_Warning, (3,0), "Top-level binding")])]
235+
, testSession' "bidirectional module dependency with hs-boot" $ \path -> do
236+
let cradle = unlines
237+
[ "cradle:"
238+
, " direct: {arguments: [ModuleA, ModuleB]}"
239+
]
240+
let contentA = T.unlines
241+
[ "module ModuleA where"
242+
, "import {-# SOURCE #-} ModuleB"
243+
]
244+
let contentB = T.unlines
245+
[ "{-# OPTIONS -Wmissing-signatures#-}"
246+
, "module ModuleB where"
247+
, "import {-# SOURCE #-} ModuleA"
248+
-- introduce an artificial diagnostic
249+
, "foo = ()"
250+
]
251+
let contentBboot = T.unlines
252+
[ "module ModuleB where"
253+
]
254+
let contentAboot = T.unlines
255+
[ "module ModuleA where"
256+
]
257+
liftIO $ writeFile (path </> "hie.yaml") cradle
258+
_ <- createDoc "ModuleA.hs" "haskell" contentA
259+
_ <- createDoc "ModuleA.hs-boot" "haskell" contentAboot
260+
_ <- createDoc "ModuleB.hs" "haskell" contentB
261+
_ <- createDoc "ModuleB.hs-boot" "haskell" contentBboot
262+
expectDiagnostics [("ModuleB.hs", [(DiagnosticSeverity_Warning, (3,0), "Top-level binding")])]
235263
, testSessionWait "correct reference used with hs-boot" $ do
236264
let contentB = T.unlines
237265
[ "module ModuleB where"

0 commit comments

Comments
 (0)