@@ -26,7 +26,7 @@ import TestUtils
2626
2727testAsyncPoll :: TestResult (AsyncResult () ) -> Process ()
2828testAsyncPoll result = do
29- hAsync <- async $ do " go" <- expect; say " running" >> return ()
29+ hAsync <- async $ asyncDo $ do " go" <- expect; say " running" >> return ()
3030 ar <- poll hAsync
3131 case ar of
3232 AsyncPending ->
@@ -35,7 +35,7 @@ testAsyncPoll result = do
3535
3636testAsyncCancel :: TestResult (AsyncResult () ) -> Process ()
3737testAsyncCancel result = do
38- hAsync <- async $ runTestProcess $ say " running" >> return ()
38+ hAsync <- async $ asyncDo $ runTestProcess $ say " running" >> return ()
3939 sleep $ milliSeconds 100
4040
4141 p <- poll hAsync -- nasty kind of assertion: use assertEquals?
@@ -47,7 +47,7 @@ testAsyncCancelWait :: TestResult (Maybe (AsyncResult ())) -> Process ()
4747testAsyncCancelWait result = do
4848 testPid <- getSelfPid
4949 p <- spawnLocal $ do
50- hAsync <- async $ runTestProcess $ sleep $ seconds 60
50+ hAsync <- async $ asyncDo $ runTestProcess $ sleep $ seconds 60
5151 sleep $ milliSeconds 100
5252
5353 send testPid " running"
@@ -65,7 +65,7 @@ testAsyncWaitTimeout :: TestResult (Maybe (AsyncResult ())) -> Process ()
6565testAsyncWaitTimeout result =
6666 let delay = seconds 1
6767 in do
68- hAsync <- async $ sleep $ seconds 20
68+ hAsync <- async $ asyncDo $ sleep $ seconds 20
6969 waitTimeout delay hAsync >>= stash result
7070 cancelWait hAsync >> return ()
7171
@@ -74,7 +74,7 @@ testAsyncWaitTimeoutCompletes :: TestResult (Maybe (AsyncResult ()))
7474testAsyncWaitTimeoutCompletes result =
7575 let delay = seconds 1
7676 in do
77- hAsync <- async $ sleep $ seconds 20
77+ hAsync <- async $ asyncDo $ sleep $ seconds 20
7878 waitTimeout delay hAsync >>= stash result
7979 cancelWait hAsync >> return ()
8080
@@ -83,15 +83,15 @@ testAsyncWaitTimeoutSTM :: TestResult (Maybe (AsyncResult ())) -> Process ()
8383testAsyncWaitTimeoutSTM result =
8484 let delay = seconds 1
8585 in do
86- hAsync <- async $ sleep $ seconds 20
86+ hAsync <- async $ asyncDo $ sleep $ seconds 20
8787 waitTimeoutSTM delay hAsync >>= stash result
8888
8989testAsyncWaitTimeoutCompletesSTM :: TestResult (Maybe (AsyncResult Int ))
9090 -> Process ()
9191testAsyncWaitTimeoutCompletesSTM result =
9292 let delay = seconds 1 in do
9393
94- hAsync <- async $ do
94+ hAsync <- async $ asyncDo $ do
9595 i <- expect
9696 return i
9797
@@ -106,7 +106,7 @@ testAsyncLinked result = do
106106 mv :: MVar (AsyncSTM () ) <- liftIO $ newEmptyMVar
107107 pid <- spawnLocal $ do
108108 -- NB: async == asyncLinked for AsyncChan
109- h <- asyncLinked $ do
109+ h <- asyncLinked $ asyncDo $ do
110110 " waiting" <- expect
111111 return ()
112112 stash mv h
@@ -134,9 +134,9 @@ testAsyncLinked result = do
134134
135135testAsyncWaitAny :: TestResult [AsyncResult String ] -> Process ()
136136testAsyncWaitAny result = do
137- p1 <- async $ expect >>= return
138- p2 <- async $ expect >>= return
139- p3 <- async $ expect >>= return
137+ p1 <- async $ asyncDo $ expect >>= return
138+ p2 <- async $ asyncDo $ expect >>= return
139+ p3 <- async $ asyncDo $ expect >>= return
140140 send (_asyncWorker p3) " c"
141141 r1 <- waitAny [p1, p2, p3]
142142
@@ -151,14 +151,14 @@ testAsyncWaitAny result = do
151151
152152testAsyncWaitAnyTimeout :: TestResult (Maybe (AsyncResult String )) -> Process ()
153153testAsyncWaitAnyTimeout result = do
154- p1 <- asyncLinked $ expect >>= return
155- p2 <- asyncLinked $ expect >>= return
156- p3 <- asyncLinked $ expect >>= return
154+ p1 <- asyncLinked $ asyncDo $ expect >>= return
155+ p2 <- asyncLinked $ asyncDo $ expect >>= return
156+ p3 <- asyncLinked $ asyncDo $ expect >>= return
157157 waitAnyTimeout (seconds 1 ) [p1, p2, p3] >>= stash result
158158
159159testAsyncCancelWith :: TestResult Bool -> Process ()
160160testAsyncCancelWith result = do
161- p1 <- async $ do { s :: String <- expect; return s }
161+ p1 <- async $ asyncDo $ do { s :: String <- expect; return s }
162162 cancelWith " foo" p1
163163 AsyncFailed (DiedException _) <- wait p1
164164 stash result True
0 commit comments