mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-10-24 12:52:29 +00:00
server: refactor syntax tests to only allow one command (#5)
* server: refactor syntax tests to only allow one command * simplify smpServerTest
This commit is contained in:
1 parent
f5aaab3861
commit
6f8b3787b0
2 files changed
+26
-29
No files matched your search
+2
-5
@@ -53,11 +53,8 @@ runSmpTestN nClients test = withSmpServer $ run [] nClients
|
||||
run hs 0 = test hs
|
||||
run hs n = testSMPClient $ \h -> run (h : hs) (n - 1)
|
||||
|
||||
smpServerTest :: [RawTransmission] -> IO [RawTransmission]
|
||||
smpServerTest commands = runSmpTest \h -> mapM (sendReceive h) commands
|
||||
where
|
||||
sendReceive :: Handle -> RawTransmission -> IO RawTransmission
|
||||
sendReceive h t = tPutRaw h t >> tGetRaw h
|
||||
smpServerTest :: RawTransmission -> IO RawTransmission
|
||||
smpServerTest cmd = runSmpTest $ \h -> tPutRaw h cmd >> tGetRaw h
|
||||
|
||||
smpTest :: (Handle -> IO ()) -> Expectation
|
||||
smpTest test' = runSmpTest test' `shouldReturn` ()
|
||||
|
||||
Reference in new issue
Block a user