Skip to content

Fix/spawn async #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Control/Distributed/Process/Tests/CH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Control.Concurrent.MVar
, takeMVar
, readMVar
)
import Control.Monad (replicateM_, replicateM, forever, void, unless)
import Control.Monad (replicateM_, replicateM, forever, void, unless, join)
import Control.Exception (SomeException, throwIO)
import qualified Control.Exception as Ex (catch)
import Control.Applicative ((<$>), (<*>), pure, (<|>))
Expand Down Expand Up @@ -719,6 +719,21 @@ testSpawnLocal TestTransport{..} = do

takeMVar done

testSpawnAsyncStrictness :: TestTransport -> Assertion
testSpawnAsyncStrictness TestTransport{..} = do
node <- newLocalNode testTransport initRemoteTable
done <- newEmptyMVar

runProcess node $ do
here <-getSelfNode

ev <- try $ spawnAsync here (error "boom")
liftIO $ case ev of
Right _ -> putMVar done (error "Exception didn't fire")
Left (_::SomeException) -> putMVar done (return ())

join $ takeMVar done

testReconnect :: TestTransport -> Assertion
testReconnect TestTransport{..} = do
[node1, node2] <- replicateM 2 $ newLocalNode testTransport initRemoteTable
Expand Down Expand Up @@ -1370,6 +1385,7 @@ tests testtrans = return [
, testCase "Registry" (testRegistry testtrans)
, testCase "RemoteRegistry" (testRemoteRegistry testtrans)
, testCase "SpawnLocal" (testSpawnLocal testtrans)
, testCase "SpawnAsyncStrictness" (testSpawnAsyncStrictness testtrans)
, testCase "HandleMessageIf" (testHandleMessageIf testtrans)
, testCase "MatchAny" (testMatchAny testtrans)
, testCase "MatchAnyHandle" (testMatchAnyHandle testtrans)
Expand Down