Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Property = Property {
- propertyConfig :: !PropertyConfig
- propertyTest :: Test IO ()
- newtype PropertyName = PropertyName {}
- data PropertyConfig = PropertyConfig {}
- newtype TestLimit = TestLimit Int
- newtype DiscardLimit = DiscardLimit Int
- newtype ShrinkLimit = ShrinkLimit Int
- property :: Test IO () -> Property
- withTests :: TestLimit -> Property -> Property
- withDiscards :: DiscardLimit -> Property -> Property
- withShrinks :: ShrinkLimit -> Property -> Property
- data Group = Group {
- groupName :: !GroupName
- groupProperties :: ![(PropertyName, Property)]
- newtype GroupName = GroupName {}
- newtype Test m a = Test {}
- data Log
- data Failure = Failure (Maybe Span) String (Maybe Diff)
- data Diff = Diff {}
- forAll :: (Monad m, Show a, HasCallStack) => Gen m a -> Test m a
- forAllWith :: (Monad m, HasCallStack) => (a -> String) -> Gen m a -> Test m a
- annotate :: (Monad m, HasCallStack) => String -> Test m ()
- annotateShow :: (Monad m, Show a, HasCallStack) => a -> Test m ()
- footnote :: Monad m => String -> Test m ()
- footnoteShow :: (Monad m, Show a) => a -> Test m ()
- discard :: Monad m => Test m a
- failure :: (Monad m, HasCallStack) => Test m a
- success :: Monad m => Test m ()
- assert :: (Monad m, HasCallStack) => Bool -> Test m ()
- (===) :: (Monad m, Eq a, Show a, HasCallStack) => a -> a -> Test m ()
- liftEither :: (Monad m, Show x, HasCallStack) => Either x a -> Test m a
- liftExceptT :: (Monad m, Show x, HasCallStack) => ExceptT x m a -> Test m a
- withResourceT :: MonadResourceBase m => Test (ResourceT m) a -> Test m a
- defaultConfig :: PropertyConfig
- mapConfig :: (PropertyConfig -> PropertyConfig) -> Property -> Property
- failWith :: (Monad m, HasCallStack) => Maybe Diff -> String -> Test m a
- writeLog :: Monad m => Log -> Test m ()
- runTest :: Test m a -> Gen m (Either Failure a, [Log])
Property
A property test to check, along with some configurable limits like how many times to run the test.
Property | |
|
newtype PropertyName Source #
The name of a property.
The number of successful tests that need to be run before a property test is considered successful.
newtype DiscardLimit Source #
The number of discards to allow before giving up.
newtype ShrinkLimit Source #
The number of shrinks to try before giving up on shrinking.
withTests :: TestLimit -> Property -> Property Source #
Set the number times a property should be executed before it is considered successful.
withDiscards :: DiscardLimit -> Property -> Property Source #
Set the number times a property is allowed to discard before the test runner gives up.
withShrinks :: ShrinkLimit -> Property -> Property Source #
Set the number times a property is allowed to shrink before the test runner gives up and prints the counterexample.
Group
A named collection of property tests.
Group | |
|
The name of a group of properties.
Test
A property test.
MFunctor Test Source # | |
MonadTrans Test Source # | |
MonadBase b m => MonadBase b (Test m) Source # | |
MonadError e m => MonadError e (Test m) Source # | |
MonadReader r m => MonadReader r (Test m) Source # | |
MonadState s m => MonadState s (Test m) Source # | |
Monad m => Monad (Test m) Source # | |
Functor m => Functor (Test m) Source # | |
Monad m => Applicative (Test m) Source # | |
MonadIO m => MonadIO (Test m) Source # | |
Monad m => Alternative (Test m) Source # | |
Monad m => MonadPlus (Test m) Source # | |
MonadCatch m => MonadCatch (Test m) Source # | |
MonadThrow m => MonadThrow (Test m) Source # | |
PrimMonad m => PrimMonad (Test m) Source # | |
MonadResource m => MonadResource (Test m) Source # | |
type PrimState (Test m) Source # | |
Log messages which are recorded during a test run.
Details on where and why a test failed.
The difference between some expected and actual value.
Diff | |
|
forAll :: (Monad m, Show a, HasCallStack) => Gen m a -> Test m a Source #
Generates a random input for the test by running the provided generator.
forAllWith :: (Monad m, HasCallStack) => (a -> String) -> Gen m a -> Test m a Source #
annotate :: (Monad m, HasCallStack) => String -> Test m () Source #
Annotates the source code with a message that might be useful for debugging a test failure.
annotateShow :: (Monad m, Show a, HasCallStack) => a -> Test m () Source #
Annotates the source code with a value that might be useful for debugging a test failure.
footnote :: Monad m => String -> Test m () Source #
Logs a message to be displayed as additional information in the footer of the failure report.
footnoteShow :: (Monad m, Show a) => a -> Test m () Source #
Logs a value to be displayed as additional information in the footer of the failure report.
assert :: (Monad m, HasCallStack) => Bool -> Test m () Source #
Fails the test if the condition provided is False
.
(===) :: (Monad m, Eq a, Show a, HasCallStack) => a -> a -> Test m () infix 4 Source #
Fails the test if the two arguments provided are not equal.
liftEither :: (Monad m, Show x, HasCallStack) => Either x a -> Test m a Source #
liftExceptT :: (Monad m, Show x, HasCallStack) => ExceptT x m a -> Test m a Source #
withResourceT :: MonadResourceBase m => Test (ResourceT m) a -> Test m a Source #
Internal
These functions are exported in case you need them in a pinch, but are not part of the public API and may change at any time, even as part of a minor update.
defaultConfig :: PropertyConfig Source #
The default configuration for a property test.
mapConfig :: (PropertyConfig -> PropertyConfig) -> Property -> Property Source #
Map a config modification function over a property.