mirror of
https://github.com/barrucadu/dejafu.git
synced 2024-12-18 02:51:42 +03:00
Add a test case to replicate issue 71.
This commit is contained in:
parent
b3c96f1f99
commit
95eed7524c
@ -51,6 +51,7 @@ tests =
|
||||
, T "deadlock2" scDeadlock2 $ gives' [(Left Deadlock, ()), (Right (), ())]
|
||||
, T "success" scSuccess $ gives' [Right ()]
|
||||
, T "illegal" scIllegal $ gives [Left IllegalSubconcurrency]
|
||||
, T "issue 71" scIssue71 $ gives' [()]
|
||||
]
|
||||
]
|
||||
where
|
||||
@ -254,3 +255,12 @@ scIllegal = do
|
||||
var <- newEmptyMVar
|
||||
void . fork $ readMVar var
|
||||
void . subconcurrency $ pure ()
|
||||
|
||||
-- | Test case from issue 71. This won't fail if the bug is
|
||||
-- reintroduced, it will just hang.
|
||||
scIssue71 :: Monad n => Conc n r ()
|
||||
scIssue71 = do
|
||||
let ma ||| mb = do { j1 <- spawn ma; j2 <- spawn mb; takeMVar j1; takeMVar j2; pure () }
|
||||
s <- newEmptyMVar
|
||||
_ <- subconcurrency (takeMVar s ||| pure ())
|
||||
pure ()
|
||||
|
Loading…
Reference in New Issue
Block a user