-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Helpers for round-trip tests
--
-- Please see the README on GitHub at
-- https://github.com/ejconlon/daytripper#readme
@package daytripper
@version 0.2.0
module Test.Daytripper
-- | Interface for asserting and performing IO in tests. TODO Migrate to
-- MonadIO superclass when Falsify supports it.
class MonadFail m => MonadExpect m
expectLiftIO :: MonadExpect m => IO a -> m a
expectAssertEq :: (MonadExpect m, Eq a, Show a) => a -> a -> m ()
expectAssertFailure :: MonadExpect m => String -> m ()
expectAssertBool :: MonadExpect m => String -> Bool -> m ()
-- | 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.
type Expect m a b c = Either b a -> m (b, m c)
-- | Assert something before processing (before encoding and before
-- decoding)
expectBefore :: Monad m => (Maybe a -> m ()) -> Expect m a b c -> Expect m a b c
-- | Assert something during processing (after encoding and before
-- decoding)
expectDuring :: Monad m => (Maybe a -> b -> m ()) -> Expect m a b c -> Expect m a b c
-- | Asserting something after processing (after encoding and after
-- decoding)
expectAfter :: Monad m => (Maybe a -> b -> c -> m ()) -> Expect m a b c -> Expect m a b c
-- | A way of definining expectations from a pair of encode/decode
-- functions and a comparison function.
mkExpect :: MonadExpect m => (a -> m b) -> (b -> m c) -> (Maybe a -> c -> m ()) -> Expect m a b c
data RT
-- | Create a property-based roundtrip test
mkPropRT :: Show a => TestName -> Expect Property a b c -> Gen a -> RT
-- | Create a file-based ("golden") roundtrip test
mkFileRT :: TestName -> Expect IO a ByteString c -> FilePath -> Maybe a -> RT
-- | Create a unit roundtrip test
mkUnitRT :: TestName -> Expect IO a b c -> a -> RT
-- | Run a roundtrip test
testRT :: RT -> TestTree
-- | 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.
newtype DaytripperWriteMissing
DaytripperWriteMissing :: Bool -> DaytripperWriteMissing
[unDaytripperWriteMissing] :: DaytripperWriteMissing -> Bool
-- | Tasty ingredients with write-missing support
daytripperIngredients :: [Ingredient]
-- | Tasty main with write-missing support
daytripperMain :: TestTree -> IO ()
instance GHC.Classes.Ord Test.Daytripper.DaytripperWriteMissing
instance GHC.Classes.Eq Test.Daytripper.DaytripperWriteMissing
instance GHC.Show.Show Test.Daytripper.DaytripperWriteMissing
instance Test.Tasty.Options.IsOption Test.Daytripper.DaytripperWriteMissing
instance Test.Daytripper.MonadExpect GHC.Types.IO
instance Test.Daytripper.MonadExpect Test.Falsify.Property.Property