-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Conveniences for using Hedgehog as a unit test runner -- -- Please see the README on GitHub at -- https://github.com/ejconlon/prop-unit#readme @package prop-unit @version 0.2.0 module PropUnit -- | These are the two ways in which one test may depend on the others. -- -- This is the same distinction as the hard vs soft dependencies in -- TestNG. data () => DependencyType -- | The current test tree will be executed after its dependencies finish, -- and only if all of the dependencies succeed. AllSucceed :: DependencyType -- | The current test tree will be executed after its dependencies finish, -- regardless of whether they succeed or not. AllFinish :: DependencyType -- | Generator for random values of a. type Gen = GenT Identity class Monad m => MonadTest (m :: Type -> Type) -- | A property test, along with some configurable limits like how many -- times to run the test. data () => Property -- | The property monad transformer allows both the generation of test -- inputs and the assertion of expectations. data () => PropertyT (m :: Type -> Type) a -- | A range describes the bounds of a number to generate, which may or may -- not be dependent on a Size. -- -- The constructor takes an origin between the lower and upper bound, and -- a function from Size to bounds. As the size goes towards -- 0, the values go towards the origin. data () => Range a -- | The number of successful tests that need to be run before a property -- test is considered successful. -- -- Can be constructed using numeric literals: -- --
-- 200 :: TestLimit --data () => TestLimit -- | The name of a test or a group of tests. type TestName = String -- | The main data structure defining a test suite. -- -- It consists of individual test cases and properties, organized in -- named groups which form a tree-like hierarchy. -- -- There is no generic way to create a test case. Instead, every test -- provider (tasty-hunit, tasty-smallcheck etc.) provides a function to -- turn a test case into a TestTree. -- -- Groups can be created using testGroup. data () => TestTree -- | Fails the test if the two arguments provided are not equal. (===) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () infix 4 === -- | Fails the test if the two arguments provided are equal. (/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () infix 4 /== -- | The after combinator declares dependencies between tests. -- -- If a TestTree is wrapped in after, the tests in this -- tree will not run until certain other tests («dependencies») have -- finished. These dependencies are specified using an AWK pattern (see -- the «Patterns» section in the README). -- -- Moreover, if the DependencyType argument is set to -- AllSucceed and at least one dependency has failed, this test -- tree will not run at all. -- -- Tasty does not check that the pattern matches any tests (let alone the -- correct set of tests), so it is on you to supply the right pattern. -- --
-- after AllFinish "Foo" $ -- ---- -- testCase "A test that depends on Foo.Bar" $ ... -- -- Note, however, that our test also happens to contain Foo as -- part of its name, so it also matches the pattern and becomes a -- dependency of itself. This will result in a DependencyLoop -- exception. To avoid this, either change the test name so that it -- doesn't mention Foo or make the pattern more specific. -- -- You can use AWK patterns, for instance, to specify the full path to -- the dependency. -- --
-- after AllFinish "$0 == \"Tests.Foo.Bar\"" $ -- ---- -- testCase "A test that depends on Foo.Bar" $ ... -- -- Or only specify the dependency's own name, ignoring the group names: -- --
-- after AllFinish "$NF == \"Bar\"" $ -- ---- -- testCase "A test that depends on Foo.Bar" $ ... after :: DependencyType -> String -> TestTree -> TestTree -- | Fails the test if the condition provided is False. assert :: (MonadTest m, HasCallStack) => Bool -> m () -- | Generates a random input for the test by running the provided -- generator. forAll :: forall (m :: Type -> Type) a. (Monad m, Show a, HasCallStack) => Gen a -> PropertyT m a testProp :: TestName -> TestLimit -> PropertyT IO () -> TestTree testUnit :: TestName -> PropertyT IO () -> TestTree defaultTestLimit :: TestLimit setupTests :: IO TestLimit -- | Create a named group of test cases or other groups. Tests are executed -- in parallel. For sequential execution, see sequentialTestGroup. testGroup :: TestName -> [TestTree] -> TestTree testMain :: (TestLimit -> TestTree) -> IO () -- | Acquire the resource to run this test (sub)tree and release it -- afterwards. withResource :: IO a -> (a -> IO ()) -> (IO a -> TestTree) -> TestTree class GenDefault tag a -- | Default generator for a -- -- The type-level tag allows types a to have multiple -- defaults. genDefault :: GenDefault tag a => Proxy tag -> Gen a genDefaultTag :: forall tag a tag'. GenDefault tag' a => Proxy tag' -> Proxy tag -> Gen a genDefaultIntegral :: forall tag a. (Integral a, Bounded a) => Proxy tag -> Gen a genDefaultEnum :: forall tag a. (Enum a, Bounded a) => Proxy tag -> Gen a genDefaultList :: forall tag a mn mx. (IsList a, KnownNat mn, KnownNat mx, GenDefault tag (Item a)) => Proxy mn -> Proxy mx -> Proxy tag -> Gen a genDefaultString :: forall tag a mn mx. (IsString a, KnownNat mn, KnownNat mx, GenDefault tag Char) => Proxy mn -> Proxy mx -> Proxy tag -> Gen a genDefaultGeneric :: forall tag a. (Generic a, GGenDefault tag (Rep a)) => Proxy tag -> Gen a -- | Type tag for these "standard" default generators. You can use this tag -- directly or choose type-by-type with ViaTag. data Std instance PropUnit.GenDefault PropUnit.Std () instance PropUnit.GenDefault PropUnit.Std GHC.Types.Bool instance PropUnit.GenDefault PropUnit.Std GHC.Types.Char instance PropUnit.GenDefault PropUnit.Std GHC.Types.Int instance PropUnit.GenDefault PropUnit.Std GHC.Int.Int8 instance PropUnit.GenDefault PropUnit.Std GHC.Int.Int16 instance PropUnit.GenDefault PropUnit.Std GHC.Int.Int32 instance PropUnit.GenDefault PropUnit.Std GHC.Int.Int64 instance PropUnit.GenDefault PropUnit.Std GHC.Types.Word instance PropUnit.GenDefault PropUnit.Std GHC.Word.Word8 instance PropUnit.GenDefault PropUnit.Std GHC.Word.Word16 instance PropUnit.GenDefault PropUnit.Std GHC.Word.Word32 instance PropUnit.GenDefault PropUnit.Std GHC.Word.Word64 instance PropUnit.GenDefault PropUnit.Std a => PropUnit.GenDefault PropUnit.Std (GHC.Maybe.Maybe a) instance (PropUnit.GenDefault PropUnit.Std a, PropUnit.GenDefault PropUnit.Std b) => PropUnit.GenDefault PropUnit.Std (Data.Either.Either a b) instance (PropUnit.GenDefault PropUnit.Std a, PropUnit.GenDefault PropUnit.Std b) => PropUnit.GenDefault PropUnit.Std (a, b) instance (PropUnit.GenDefault PropUnit.Std a, PropUnit.GenDefault PropUnit.Std b, PropUnit.GenDefault PropUnit.Std c) => PropUnit.GenDefault PropUnit.Std (a, b, c) instance (PropUnit.GenDefault PropUnit.Std a, PropUnit.GenDefault PropUnit.Std b, PropUnit.GenDefault PropUnit.Std c, PropUnit.GenDefault PropUnit.Std d) => PropUnit.GenDefault PropUnit.Std (a, b, c, d) instance (PropUnit.GenDefault PropUnit.Std a, PropUnit.GenDefault PropUnit.Std b, PropUnit.GenDefault PropUnit.Std c, PropUnit.GenDefault PropUnit.Std d, PropUnit.GenDefault PropUnit.Std e) => PropUnit.GenDefault PropUnit.Std (a, b, c, d, e) instance (GHC.Generics.Generic a, PropUnit.GGenDefault tag (GHC.Generics.Rep a)) => PropUnit.GenDefault tag (PropUnit.ViaGeneric tag a) instance PropUnit.GGenDefault tag GHC.Generics.U1 instance PropUnit.GGenDefault tag a => PropUnit.GGenDefault tag (GHC.Generics.M1 i c a) instance (PropUnit.GGenDefault tag a, PropUnit.GGenDefault tag b) => PropUnit.GGenDefault tag (a GHC.Generics.:*: b) instance (PropUnit.GGenDefault tag a, PropUnit.GGenDefault tag b) => PropUnit.GGenDefault tag (a GHC.Generics.:+: b) instance PropUnit.GenDefault tag a => PropUnit.GGenDefault tag (GHC.Generics.K1 i a) instance (Data.String.IsString s, PropUnit.GenDefault tag GHC.Types.Char, GHC.TypeNats.KnownNat mn, GHC.TypeNats.KnownNat mx) => PropUnit.GenDefault tag (PropUnit.ViaString s mn mx) instance (GHC.IsList.IsList a, PropUnit.GenDefault tag (GHC.IsList.Item a), GHC.TypeNats.KnownNat mn, GHC.TypeNats.KnownNat mx) => PropUnit.GenDefault tag (PropUnit.ViaList a mn mx) instance (GHC.Enum.Enum a, GHC.Enum.Bounded a) => PropUnit.GenDefault tag (PropUnit.ViaEnum a) instance (GHC.Real.Integral a, GHC.Enum.Bounded a) => PropUnit.GenDefault tag (PropUnit.ViaIntegral a) instance PropUnit.GenDefault tag' a => PropUnit.GenDefault tag (PropUnit.ViaTag tag' a)