@@ -369,15 +369,42 @@ testTimeout0 transport = do
370 takeMVar clientDone
370 takeMVar clientDone
372+-- | Test typed channels
373+testTypedChannels :: NT.Transport -> IO ()
374+testTypedChannels transport = do
375+ serverChannel <- newEmptyMVar :: IO (MVar (SendPort (SendPort Bool, Int)))
376+ clientDone <- newEmptyMVar
379+ localNode <- newLocalNode transport initRemoteTable
380+ forkProcess localNode $ do
381+ (serverSendPort, rport) <- newChan
382+ liftIO $ putMVar serverChannel serverSendPort
383+ (clientSendPort, i) <- receiveChan rport
384+ sendChan clientSendPort (even i)
388+ localNode <- newLocalNode transport initRemoteTable
389+ serverSendPort <- readMVar serverChannel
390+ runProcess localNode $ do
391+ (clientSendPort, rport) <- newChan
392+ sendChan serverSendPort (clientSendPort, 5)
393+ False <- receiveChan rport
394+ liftIO $ putMVar clientDone ()
372main :: IO ()
398main :: IO ()
374 Right transport <- createTransport "127.0.0.1" "8080" defaultTCPParameters
400 Right transport <- createTransport "127.0.0.1" "8080" defaultTCPParameters
375 runTests
401 runTests
376− [ ("Ping", testPing transport)
402+ [ ("Ping", testPing transport)
377− , ("Math", testMath transport)
403+ , ("Math", testMath transport)
378− , ("Timeout", testTimeout transport)
404+ , ("Timeout", testTimeout transport)
379− , ("Timeout0", testTimeout0 transport)
405+ , ("Timeout0", testTimeout0 transport)
380 , ("SendToTerminated", testSendToTerminated transport)
406 , ("SendToTerminated", testSendToTerminated transport)
407+ , ("TypedChannnels", testTypedChannels transport)
381 -- The "missing" combinations in the list below don't make much sense, as
408 -- The "missing" combinations in the list below don't make much sense, as
382 -- we cannot guarantee that the monitor reply or link exception will not
409 -- we cannot guarantee that the monitor reply or link exception will not
383 -- happen before the unmonitor or unlink
410 -- happen before the unmonitor or unlink