Skip to content

Commit c03acb8

Browse files
Implement a test for unsafeNSendRemote.
1 parent ef5cb4d commit c03acb8

File tree

1 file changed

+20
-0
lines changed
  • distributed-process-tests/src/Control/Distributed/Process/Tests

1 file changed

+20
-0
lines changed

distributed-process-tests/src/Control/Distributed/Process/Tests/CH.hs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,25 @@ testUnsafeNSend TestTransport{..} = do
14211421

14221422
takeMVar clientDone
14231423

1424+
testUnsafeNSendRemote :: TestTransport -> Assertion
1425+
testUnsafeNSendRemote TestTransport{..} = do
1426+
clientDone <- newEmptyMVar
1427+
1428+
localNode1 <- newLocalNode testTransport initRemoteTable
1429+
localNode2 <- newLocalNode testTransport initRemoteTable
1430+
1431+
_ <- forkProcess localNode1 $ do
1432+
getSelfPid >>= register "foobar"
1433+
liftIO $ putMVar clientDone ()
1434+
() <- expect
1435+
liftIO $ putMVar clientDone ()
1436+
1437+
takeMVar clientDone
1438+
void $ runProcess localNode2 $ do
1439+
unsafeNSendRemote (localNodeId localNode1) "foobar" ()
1440+
1441+
takeMVar clientDone
1442+
14241443
testUnsafeSendChan :: TestTransport -> Assertion
14251444
testUnsafeSendChan TestTransport{..} = do
14261445
serverAddr <- newEmptyMVar
@@ -1561,6 +1580,7 @@ tests testtrans = return [
15611580
, testCase "TestUnsafeSend" (testUnsafeSend testtrans)
15621581
, testCase "TestUnsafeUSend" (testUnsafeUSend testtrans)
15631582
, testCase "TestUnsafeNSend" (testUnsafeNSend testtrans)
1583+
, testCase "TestUnsafeNSendRemote" (testUnsafeNSendRemote testtrans)
15641584
, testCase "TestUnsafeSendChan" (testUnsafeSendChan testtrans)
15651585
-- usend
15661586
, testCase "USend" (testUSend usend testtrans 50)

0 commit comments

Comments
 (0)