git.iko.soy/distributed-process
on master help sign in
test 'die'
commit5f107a0030eb744a9507934f001f9da26fb92b90 authorTim Watson <tim@rabbitmq.com> dateThu 17 Jan 2013, 01:14 (14 years ago) parentd255e1c
2 files changed+17
distributed-process/src/Control/Distributed/Process.hs+2 distributed-process/tests/TestCH.hs+15
distributed-process/src/Control/Distributed/Process.hs+2
@@ -44,6 +44,7 @@ module Control.Distributed.Process
4444 , spawn
4545 , call
4646 , terminate
47+ , die
4748 , kill
4849 , exit
4950 , catchExit
@@ -195,6 +196,7 @@ import Control.Distributed.Process.Internal.Primitives
195196 -- Process management
196197 , terminate
197198 , ProcessTerminationException(..)
199+ , die
198200 , exit
199201 , catchExit
200202 , kill
distributed-process/tests/TestCH.hs+15
@@ -894,6 +894,20 @@ testKillRemote transport = do
894894
895895 takeMVar done
896896
897+testDie :: NT.Transport -> Assertion
898+testDie transport = do
899+ localNode <- newLocalNode transport initRemoteTable
900+ done <- newEmptyMVar
901+
902+ _ <- forkProcess localNode $ do
903+ (die ("foobar", 123 :: Int))
904+ `catchExit` \_from reason -> do
905+ -- TODO: should verify that 'from' has the right value
906+ True <- return $ reason == ("foobar", 123 :: Int)
907+ liftIO $ putMVar done ()
908+
909+ takeMVar done
910+
897911testExitLocal :: NT.Transport -> Assertion
898912testExitLocal transport = do
899913 localNode <- newLocalNode transport initRemoteTable
@@ -961,6 +975,7 @@ tests (transport, transportInternals) = [
961975 , testCase "ReceiveChanFeatures" (testReceiveChanFeatures transport)
962976 , testCase "KillLocal" (testKillLocal transport)
963977 , testCase "KillRemote" (testKillRemote transport)
978+ , testCase "Die" (testDie transport)
964979 , testCase "ExitLocal" (testExitLocal transport)
965980 , testCase "ExitRemote" (testExitRemote transport)
966981 ]