From 14e7a6eda83d87b0454449097bdc3bce37098843 Mon Sep 17 00:00:00 2001 From: Stevan Andjelkovic Date: Fri, 7 May 2021 11:39:17 +0200 Subject: [PATCH] refactor(runtime): move transport test to testsuite --- src/runtime-prototype/stunt-double.cabal | 1 + .../StuntDouble/EventLoop/TransportTest.hs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/runtime-prototype/test/StuntDouble/EventLoop/TransportTest.hs diff --git a/src/runtime-prototype/stunt-double.cabal b/src/runtime-prototype/stunt-double.cabal index 56c16a4d..d541c8ca 100644 --- a/src/runtime-prototype/stunt-double.cabal +++ b/src/runtime-prototype/stunt-double.cabal @@ -62,6 +62,7 @@ test-suite test , tasty-hunit other-modules: + StuntDouble.EventLoop.TransportTest StuntDouble.EventLoopTest TastyDiscover diff --git a/src/runtime-prototype/test/StuntDouble/EventLoop/TransportTest.hs b/src/runtime-prototype/test/StuntDouble/EventLoop/TransportTest.hs new file mode 100644 index 00000000..93ebbd75 --- /dev/null +++ b/src/runtime-prototype/test/StuntDouble/EventLoop/TransportTest.hs @@ -0,0 +1,18 @@ +module StuntDouble.EventLoop.TransportTest where + +import Control.Concurrent.Async +import Test.HUnit + +import StuntDouble.EventLoop.Transport +import StuntDouble + +------------------------------------------------------------------------ + +unit_sendReceive :: IO () +unit_sendReceive = do + t <- namedPipeTransport "/tmp" (EventLoopName "a") + let e = Envelope RequestKind (RemoteRef "from" 0) (Message "msg") (RemoteRef "a" 1) 0 + a <- async (transportSend t e) + e' <- transportReceive t + cancel a + e' @?= e