Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Test.Daytripper
Synopsis
- type Expect m a b c = Either b a -> m (b, m c)
- expectBefore :: Monad m => (Maybe a -> m ()) -> Expect m a b c -> Expect m a b c
- expectDuring :: Monad m => (Maybe a -> b -> m ()) -> Expect m a b c -> Expect m a b c
- expectAfter :: Monad m => (Maybe a -> b -> c -> m ()) -> Expect m a b c -> Expect m a b c
- mkExpect :: Monad m => (a -> m b) -> (b -> m c) -> (Maybe a -> c -> m ()) -> Expect m a b c
- runExpect :: Monad m => Expect m a b c -> a -> m c
- data RT
- mkPropRT :: Show a => TestName -> Expect (PropertyT IO) a b c -> Gen a -> RT
- mkFileRT :: TestName -> Expect (TestT IO) a ByteString c -> FilePath -> Maybe a -> RT
- mkUnitRT :: TestName -> Expect (TestT IO) a b c -> a -> RT
- testRT :: Maybe TestLimit -> RT -> TestTree
- newtype DaytripperWriteMissing = DaytripperWriteMissing {}
- daytripperIngredients :: [Ingredient]
- daytripperMain :: (TestLimit -> TestTree) -> IO ()
Documentation
type Expect m a b c = Either b a -> m (b, m c) Source #
A general type of test expectation. Captures two stages of processing an input,
first encoding, then decoding. The monad is typically something implementing
MonadExpect
, with assertions performed before returning values for further processing.
The input is possibly missing, in which case we test decoding only.
expectBefore :: Monad m => (Maybe a -> m ()) -> Expect m a b c -> Expect m a b c Source #
Assert something before processing (before encoding and before decoding)
expectDuring :: Monad m => (Maybe a -> b -> m ()) -> Expect m a b c -> Expect m a b c Source #
Assert something during processing (after encoding and before decoding)
expectAfter :: Monad m => (Maybe a -> b -> c -> m ()) -> Expect m a b c -> Expect m a b c Source #
Asserting something after processing (after encoding and after decoding)
mkExpect :: Monad m => (a -> m b) -> (b -> m c) -> (Maybe a -> c -> m ()) -> Expect m a b c Source #
A way of definining expectations from a pair of encode/decode functions and a comparison function.
runExpect :: Monad m => Expect m a b c -> a -> m c Source #
Simple way to run an expectation, ignoring the intermediate value.
mkPropRT :: Show a => TestName -> Expect (PropertyT IO) a b c -> Gen a -> RT Source #
Create a property-based roundtrip test
mkFileRT :: TestName -> Expect (TestT IO) a ByteString c -> FilePath -> Maybe a -> RT Source #
Create a file-based ("golden") roundtrip test
newtype DaytripperWriteMissing Source #
By passing the appropriate arguments to Tasty (`--daytripper-write-missing` or `TASTY_DAYTRIPPER_WRITE_MISSING=True`) we can fill in the contents of missing files with the results of running tests.
Constructors
DaytripperWriteMissing | |
Fields |
Instances
daytripperIngredients :: [Ingredient] Source #
Tasty ingredients with write-missing support