Skip to content

Commit d8ab5ee

Browse files
committed
Remove all dependencies on rematch
1 parent 0f8db66 commit d8ab5ee

21 files changed

+95
-183
lines changed

packages/distributed-process-async/distributed-process-async.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ test-suite AsyncTests
7979
stm >= 2.3 && < 2.6,
8080
test-framework >= 0.6 && < 0.9,
8181
test-framework-hunit,
82-
rematch >= 0.2.0.0,
8382
transformers
8483
hs-source-dirs:
8584
tests

packages/distributed-process-client-server/distributed-process-client-server.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ test-suite ManagedProcessTests
9292
test-framework >= 0.6 && < 0.9,
9393
test-framework-hunit,
9494
transformers,
95-
rematch >= 0.2.0.0,
9695
ghc-prim,
9796
exceptions
9897
other-modules: Counter,
@@ -131,7 +130,6 @@ test-suite PrioritisedProcessTests
131130
test-framework,
132131
test-framework-hunit,
133132
transformers,
134-
rematch,
135133
ghc-prim,
136134
exceptions
137135
other-modules: ManagedProcessCommon,

packages/distributed-process-client-server/tests/TestManagedProcess.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Control.Distributed.Process.ManagedProcess
2020
import Control.Distributed.Process.SysTest.Utils
2121
import Control.Distributed.Process.Extras.Time
2222
import Control.Distributed.Process.Serializable()
23+
import Control.Monad (replicateM_)
2324

2425
import MathsDemo
2526
import Counter
@@ -197,7 +198,7 @@ testCounterExceedsLimit result = do
197198
mref <- monitor pid
198199

199200
-- exceed the limit
200-
9 `times` (void $ incCount pid)
201+
9 `replicateM_` (void $ incCount pid)
201202

202203
-- this time we should fail
203204
_ <- (incCount pid)

packages/distributed-process-execution/distributed-process-execution.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ test-suite ExchangeTests
9898
QuickCheck >= 2.4,
9999
test-framework-quickcheck2,
100100
transformers,
101-
rematch >= 0.2.0.0,
102101
ghc-prim
103102
hs-source-dirs:
104103
tests
@@ -139,7 +138,6 @@ test-suite MailboxTests
139138
QuickCheck >= 2.4,
140139
test-framework-quickcheck2,
141140
transformers,
142-
rematch >= 0.2.0.0,
143141
ghc-prim
144142
hs-source-dirs:
145143
tests

packages/distributed-process-execution/tests/TestExchange.hs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import qualified Control.Distributed.Process.Execution.EventManager as EventMana
1818
)
1919
import Control.Distributed.Process.SysTest.Utils
2020
import Control.Monad (void, forM, forever)
21-
import Control.Rematch (equalTo)
2221

2322
import Prelude hiding (drop)
2423
import Network.Transport.TCP
2524
import qualified Network.Transport as NT
2625
import Test.Framework as TF (defaultMain, testGroup, Test)
2726
import Test.Framework.Providers.HUnit
27+
import Test.HUnit (assertEqual, assertBool)
2828

2929
testKeyBasedRouting :: TestResult Bool -> Process ()
3030
testKeyBasedRouting result = do
@@ -67,20 +67,22 @@ testMultipleRoutes result = do
6767
received <- forM (replicate (2 * 3) us) (const $ receiveChanTimeout 1000 rp)
6868

6969
-- all bindings for 'abc' fired correctly
70-
received `shouldContain` Just (p1, Left "Hello")
71-
received `shouldContain` Just (p3, Left "Hello")
72-
received `shouldContain` Just (p1, Right (123 :: Int))
73-
received `shouldContain` Just (p3, Right (123 :: Int))
74-
75-
-- however the bindings for 'def' never fired
76-
received `shouldContain` Nothing
77-
received `shouldNotContain` Just (p2, Left "Hello")
78-
received `shouldNotContain` Just (p2, Right (123 :: Int))
79-
80-
-- none of the bindings should have examined the headers!
81-
received `shouldNotContain` Just (p1, Left "Goodbye")
82-
received `shouldNotContain` Just (p2, Left "Goodbye")
83-
received `shouldNotContain` Just (p3, Left "Goodbye")
70+
liftIO $ do
71+
72+
assertBool mempty $ Just (p1, Left "Hello") `elem` received
73+
assertBool mempty $ Just (p3, Left "Hello") `elem` received
74+
assertBool mempty $ Just (p1, Right (123 :: Int)) `elem` received
75+
assertBool mempty $ Just (p3, Right (123 :: Int)) `elem` received
76+
77+
-- however the bindings for 'def' never fired
78+
assertBool mempty $ Nothing `elem` received
79+
assertBool mempty $ Just (p2, Left "Hello") `notElem` received
80+
assertBool mempty $ Just (p2, Right (123 :: Int)) `notElem` received
81+
82+
-- none of the bindings should have examined the headers!
83+
assertBool mempty $ Just (p1, Left "Goodbye") `notElem` received
84+
assertBool mempty $ Just (p2, Left "Goodbye") `notElem` received
85+
assertBool mempty $ Just (p3, Left "Goodbye") `notElem` received
8486

8587
testHeaderBasedRouting :: TestResult () -> Process ()
8688
testHeaderBasedRouting result = do
@@ -110,14 +112,16 @@ testHeaderBasedRouting result = do
110112
received <- forM (replicate 5 us) (const $ receiveChanTimeout 1000 rp)
111113

112114
-- all bindings fired correctly
113-
received `shouldContain` Just (p1, Left "Hello")
114-
received `shouldContain` Just (p1, Right (123 :: Int))
115-
received `shouldContain` Just (p2, Right (456 :: Int))
116-
received `shouldContain` Just (p2, Right (789 :: Int))
117-
received `shouldContain` Nothing
115+
liftIO $ do
116+
assertBool mempty $ Just (p1, Left "Hello") `elem` received
117+
assertBool mempty $ Just (p1, Left "Hello") `elem` received
118+
assertBool mempty $ Just (p1, Right (123 :: Int)) `elem` received
119+
assertBool mempty $ Just (p2, Right (456 :: Int)) `elem` received
120+
assertBool mempty $ Just (p2, Right (789 :: Int)) `elem` received
121+
assertBool mempty $ Nothing `elem` received
118122

119123
-- simple check that no other bindings have fired
120-
length received `shouldBe` equalTo (5 :: Int)
124+
liftIO $ assertEqual mempty 5 (length received)
121125

122126
testSimpleEventHandling :: TestResult Bool -> Process ()
123127
testSimpleEventHandling result = do

packages/distributed-process-execution/tests/TestMailbox.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import Control.Distributed.Process.Extras.Time
1313
import Control.Distributed.Process.Extras.Timer
1414
import Control.Distributed.Process.SysTest.Utils
1515

16-
17-
import Control.Rematch (equalTo)
18-
1916
import Prelude hiding (drop)
2017

2118
import Data.Maybe (catMaybes)
2219

2320
import Test.Framework as TF (defaultMain, testGroup, Test)
2421
import Test.Framework.Providers.HUnit
22+
import Test.HUnit (assertEqual)
2523

2624
import qualified MailboxTestFilters (__remoteTable)
2725
import MailboxTestFilters (myFilter, intFilter)
@@ -77,9 +75,10 @@ bufferLimiting buffT result = do
7775
MailboxStats{ pendingMessages = pending'
7876
, droppedMessages = dropped'
7977
, currentLimit = limit' } <- statistics mbox
80-
pending' `shouldBe` equalTo 4
81-
dropped' `shouldBe` equalTo 3
82-
limit' `shouldBe` equalTo 4
78+
liftIO $ do
79+
assertEqual mempty 4 pending'
80+
assertEqual mempty 3 dropped'
81+
assertEqual mempty 4 limit'
8382

8483
active mbox acceptEverything
8584
Just Delivery{ messages = recvd

packages/distributed-process-extras/distributed-process-extras.cabal

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ test-suite InternalQueueTests
8181
test-framework-hunit,
8282
QuickCheck >= 2.4,
8383
test-framework-quickcheck2,
84-
rematch >= 0.2.0.0,
8584
ghc-prim
8685
hs-source-dirs: tests
8786
ghc-options: -rtsopts
@@ -110,7 +109,6 @@ test-suite PrimitivesTests
110109
stm,
111110
test-framework >= 0.6 && < 0.9,
112111
test-framework-hunit,
113-
rematch >= 0.2.0.0,
114112
transformers
115113
hs-source-dirs: tests
116114
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
@@ -135,7 +133,6 @@ test-suite TimerTests
135133
test-framework-hunit,
136134
QuickCheck >= 2.4,
137135
test-framework-quickcheck2,
138-
rematch >= 0.2.0.0,
139136
ghc-prim
140137
hs-source-dirs: tests
141138
ghc-options: -rtsopts
@@ -172,7 +169,6 @@ test-suite LoggerTests
172169
test-framework >= 0.6 && < 0.9,
173170
test-framework-hunit,
174171
transformers,
175-
rematch >= 0.2.0.0,
176172
ghc-prim
177173
hs-source-dirs: tests
178174
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind

packages/distributed-process-extras/tests/TestLog.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
module Main where
66

7-
-- import Control.Exception (SomeException)
87
import Control.Concurrent.MVar (MVar, newMVar, takeMVar, putMVar, newEmptyMVar)
98
import Control.Concurrent.STM (atomically)
109
import Control.Concurrent.STM.TChan
1110
import Control.Distributed.Process hiding (monitor)
1211
import Control.Distributed.Process.Closure (remotable, mkStaticClosure)
1312
import Control.Distributed.Process.Node
1413
import Control.Distributed.Process.Extras hiding (__remoteTable)
15-
import qualified Control.Distributed.Process.Extras.SystemLog as Log (Logger, error)
14+
import qualified Control.Distributed.Process.Extras.SystemLog as Log (Logger)
1615
import Control.Distributed.Process.Extras.SystemLog hiding (Logger, error)
1716
import Control.Distributed.Process.SysTest.Utils
1817
import Control.Distributed.Process.Extras.Time
@@ -31,7 +30,6 @@ import GHC.Read
3130
import Text.ParserCombinators.ReadP as P
3231
import Text.ParserCombinators.ReadPrec
3332

34-
import qualified Network.Transport as NT
3533

3634
logLevelFormatter :: Message -> Process (Maybe String)
3735
logLevelFormatter m = handleMessage m showLevel

packages/distributed-process-extras/tests/TestPrimitives.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ import Control.Distributed.Process.Extras.Call
1616
import Control.Distributed.Process.Extras.Monitoring
1717
import Control.Distributed.Process.Extras.Time
1818
import Control.Monad (void)
19-
import Control.Rematch hiding (match)
20-
import qualified Network.Transport as NT (Transport)
2119
import Network.Transport.TCP()
2220

23-
import Test.HUnit (Assertion)
21+
import Test.HUnit (Assertion, assertEqual, assertBool)
2422
import Test.Framework (Test, testGroup, defaultMain)
2523
import Test.Framework.Providers.HUnit (testCase)
2624
import Network.Transport.TCP
@@ -113,8 +111,9 @@ testMonitorNodeDeath transport result = do
113111
mn1 <- liftIO $ takeMVar nid2
114112
mn2 <- liftIO $ takeMVar nid3
115113

116-
[mn1, mn2] `shouldContain` n1
117-
[mn1, mn2] `shouldContain` n2
114+
liftIO $ do
115+
assertBool mempty $ n1 `elem` [mn1, mn2]
116+
assertBool mempty $ n2 `elem` [mn1, mn2]
118117

119118
nid4 <- liftIO $ newEmptyMVar
120119
node4 <- liftIO $ newLocalNode transport initRemoteTable
@@ -125,7 +124,7 @@ testMonitorNodeDeath transport result = do
125124

126125
mn3 <- liftIO $ takeMVar nid4
127126
NodeUp n3 <- expect
128-
mn3 `shouldBe` (equalTo n3)
127+
liftIO $ assertEqual mempty n3 mn3
129128

130129
liftIO $ closeLocalNode node4
131130
stash result ()

packages/distributed-process-extras/tests/TestQueues.hs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
{-# LANGUAGE PatternGuards #-}
2+
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
23
module Main where
34

45
import qualified Control.Distributed.Process.Extras.Internal.Queue.SeqQ as FIFO
56
import Control.Distributed.Process.Extras.Internal.Queue.SeqQ ( SeqQ )
67
import qualified Control.Distributed.Process.Extras.Internal.Queue.PriorityQ as PQ
78

8-
import Control.Rematch hiding (on)
9-
import Control.Rematch.Run
109
import Data.Function (on)
11-
import Data.List
10+
import Data.List ( sortBy )
1211
import Test.Framework as TF (defaultMain, testGroup, Test)
1312
import Test.Framework.Providers.HUnit
1413
import Test.Framework.Providers.QuickCheck2 (testProperty)
15-
import Test.HUnit (Assertion, assertFailure)
14+
import Test.HUnit (assertBool, assertEqual)
1615

1716
import Prelude
1817

19-
expectThat :: a -> Matcher a -> Assertion
20-
expectThat a matcher = case res of
21-
MatchSuccess -> return ()
22-
(MatchFailure msg) -> assertFailure msg
23-
where res = runMatch matcher a
2418

2519
-- NB: these tests/properties are not meant to be complete, but rather
2620
-- they exercise the small number of behaviours that we actually use!
@@ -72,13 +66,11 @@ tests = [
7266
],
7367
testGroup "FIFO Queue Tests" [
7468
testCase "New Queue Should Be Empty"
75-
(expectThat (FIFO.isEmpty $ FIFO.empty) $ equalTo True),
69+
(assertBool mempty (FIFO.isEmpty $ FIFO.empty)),
7670
testCase "Singleton Queue Should Contain One Element"
77-
(expectThat (FIFO.dequeue $ FIFO.singleton "hello") $
78-
equalTo $ Just ("hello", FIFO.empty)),
71+
(assertEqual mempty (FIFO.dequeue $ FIFO.singleton "hello") $ Just ("hello", FIFO.empty)),
7972
testCase "Dequeue Empty Queue Should Be Nothing"
80-
(expectThat (FIFO.dequeue $ (FIFO.empty :: SeqQ ())) $
81-
is (Nothing :: Maybe ((), SeqQ ()))),
73+
(assertEqual mempty (FIFO.dequeue $ (FIFO.empty :: SeqQ ())) $ (Nothing :: Maybe ((), SeqQ ()))),
8274
testProperty "Enqueue/Dequeue should respect FIFO order"
8375
prop_fifo_enqueue,
8476
testProperty "Enqueue/Dequeue should respect isEmpty"

packages/distributed-process-extras/tests/TestTimer.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Control.Concurrent.MVar
99
, takeMVar
1010
, withMVar
1111
)
12-
import qualified Network.Transport as NT (Transport)
1312
import Network.Transport.TCP()
1413
import Control.DeepSeq (NFData)
1514
import Control.Distributed.Process

packages/distributed-process-supervisor/distributed-process-supervisor.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ test-suite SupervisorTests
8282
stm,
8383
test-framework >= 0.6 && < 0.9,
8484
test-framework-hunit,
85-
rematch >= 0.2.0.0,
8685
exceptions >= 0.10 && < 0.11
8786
hs-source-dirs: tests
8887
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-name-shadowing -fno-warn-unused-do-bind
@@ -111,7 +110,6 @@ test-suite NonThreadedSupervisorTests
111110
stm,
112111
test-framework >= 0.6 && < 0.9,
113112
test-framework-hunit,
114-
rematch >= 0.2.0.0,
115113
exceptions >= 0.10 && < 0.11
116114
hs-source-dirs: tests
117115
ghc-options: -rtsopts -fno-warn-unused-do-bind -fno-warn-name-shadowing

0 commit comments

Comments
 (0)