| Copyright | (c) 2022 Tim Emiola |
|---|---|
| License | BSD3 |
| Maintainer | Tim Emiola <adetokunbo@emio.la> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Attoparsec.Framer.Testing
Contents
Description
This module provides combinators that simplify unit tests of code that
use .Framers
Synopsis
- parsesFromFramerOk :: Eq a => (a -> ByteString) -> Parser a -> Word32 -> [a] -> IO Bool
- chunksOfN :: Int -> ByteString -> [ByteString]
- linkedSrcAndSink :: [ByteString] -> IO (ByteSource IO, ByteString -> IO ())
- linkedSrcAndSink' :: [ByteString] -> IO (ByteSource IO, ByteString -> IO ())
testing combinators
parsesFromFramerOk :: Eq a => (a -> ByteString) -> Parser a -> Word32 -> [a] -> IO Bool Source #
Creates a Framer and uses 'runFramer to confirm that the expect frames
are received '
chunksOfN :: Int -> ByteString -> [ByteString] Source #
Split a ByteString into chunks of given size
linkedSrcAndSink :: [ByteString] -> IO (ByteSource IO, ByteString -> IO ()) Source #
A linked to a byte sink.ByteSource
Provides a ByteSource and byte sink that emulate a responding endpoint.
The responses are consumed each time the byte sink is invoked.
Whenever the sink is invoked, the head of the provided responses is removed
and starts to be returned in chunks by the ByteSource,
linkedSrcAndSink' :: [ByteString] -> IO (ByteSource IO, ByteString -> IO ()) Source #
Like linkedSrcAndSink, but prints the src and sink to output as debug