git.iko.soy/distributed-process
on master help sign in
test 'die'
5f107a0Tim Watson
distributed-process/src/Control/Distributed/Process.hs+2
@@ -44,6 +44,7 @@ module Control.Distributed.Process
44 , spawn
44 , spawn
45 , call
45 , call
46 , terminate
46 , terminate
47+ , die
47 , kill
48 , kill
48 , exit
49 , exit
49 , catchExit
50 , catchExit
@@ -195,6 +196,7 @@ import Control.Distributed.Process.Internal.Primitives
195 -- Process management
196 -- Process management
196 , terminate
197 , terminate
197 , ProcessTerminationException(..)
198 , ProcessTerminationException(..)
199+ , die
198 , exit
200 , exit
199 , catchExit
201 , catchExit
200 , kill
202 , kill
distributed-process/tests/TestCH.hs+15
@@ -894,6 +894,20 @@ testKillRemote transport = do
894
894
895 takeMVar done
895 takeMVar done
896
896
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+
897testExitLocal :: NT.Transport -> Assertion
911testExitLocal :: NT.Transport -> Assertion
898testExitLocal transport = do
912testExitLocal transport = do
899 localNode <- newLocalNode transport initRemoteTable
913 localNode <- newLocalNode transport initRemoteTable
@@ -961,6 +975,7 @@ tests (transport, transportInternals) = [
961 , testCase "ReceiveChanFeatures" (testReceiveChanFeatures transport)
975 , testCase "ReceiveChanFeatures" (testReceiveChanFeatures transport)
962 , testCase "KillLocal" (testKillLocal transport)
976 , testCase "KillLocal" (testKillLocal transport)
963 , testCase "KillRemote" (testKillRemote transport)
977 , testCase "KillRemote" (testKillRemote transport)
978+ , testCase "Die" (testDie transport)
964 , testCase "ExitLocal" (testExitLocal transport)
979 , testCase "ExitLocal" (testExitLocal transport)
965 , testCase "ExitRemote" (testExitRemote transport)
980 , testCase "ExitRemote" (testExitRemote transport)
966 ]
981 ]