Skip to content

Commit

Permalink
Ported distributed-process-async
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Jan 8, 2025
1 parent 7dcaf82 commit 4790859
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ test-suite AsyncTests
network-transport-tcp >= 0.6 && < 0.9,
binary >= 0.8 && < 0.9,
deepseq >= 1.4 && < 1.7,
-- HUnit >= 1.2 && < 2,
stm >= 2.3 && < 2.6,
test-framework >= 0.6 && < 0.9,
test-framework-hunit,
tasty >= 1.5 && <1.6,
tasty-hunit >=0.10 && <0.11,
transformers
hs-source-dirs:
tests
hs-source-dirs: tests
default-language: Haskell2010
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
default-extensions: CPP
Expand Down
12 changes: 6 additions & 6 deletions packages/distributed-process-async/tests/TestAsync.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import Data.Typeable()
import Network.Transport.TCP
import qualified Network.Transport as NT

import Test.Framework (Test, testGroup, defaultMain)
import Test.Framework.Providers.HUnit (testCase)
import Test.Tasty(TestTree, testGroup, defaultMain)
import Test.Tasty.HUnit (testCase)

testAsyncPoll :: TestResult (AsyncResult ()) -> Process ()
testAsyncPoll result = do
Expand Down Expand Up @@ -158,8 +158,8 @@ testAsyncRecursive result = do
myNode <- getSelfNode
fib (myNode,6) >>= stash result

tests :: LocalNode -> [Test]
tests localNode = [
tests :: LocalNode -> TestTree
tests localNode = testGroup "" [
testGroup "Handling async results with STM" [
testCase "testAsyncCancel"
(delayedAssertion
Expand Down Expand Up @@ -210,14 +210,14 @@ tests localNode = [
]
]

asyncStmTests :: NT.Transport -> IO [Test]
asyncStmTests :: NT.Transport -> IO TestTree
asyncStmTests transport = do
localNode <- newLocalNode transport $ __remoteTableDecl initRemoteTable
let testData = tests localNode
return testData

-- | Given a @builder@ function, make and run a test suite on a single transport
testMain :: (NT.Transport -> IO [Test]) -> IO ()
testMain :: (NT.Transport -> IO TestTree) -> IO ()
testMain builder = do
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
testData <- builder transport
Expand Down

0 comments on commit 4790859

Please sign in to comment.