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:
Evgeny Poberezkin authored and GitHub committed 2021-01-11 14:04:21 +00:00
1 parent f5aaab3861
commit 6f8b3787b0
2 files changed
+26 -29

No files matched your search

+2 -5
View File
@@ -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` ()