quickpull-0.4.0.0: Generate Main module with QuickCheck tests

Safe HaskellSafe-Inferred
LanguageHaskell2010

Quickpull.Runners

Contents

Description

Running tests. To check a TestTree in a REPL, use quickCheckTree; to check a QuickCheck Testable, just use quickCheck and the similar functions in Test.QuickCheck. The other functions in this module will be more useful for checking from within a compiled test program.

The QuickCheck docs in Test.QuickCheck contain warnings about how type defaulting in GHCi can cause types to silently default to (); all those warnings also apply to use of the functions in this module. Although QuickCheck has some Template Haskell to help with this, Quickpull currently does not. You don't have to worry about this in non-interactive use, as the defaulting rules are more strict and, with warnings on, GHC will warn you when it defaults a type.

Synopsis

Testing TestTree

quickCheckTree :: TestTree -> IO () Source

Checks a TestTree and prints the result to standard output. Intended for use in a REPL; however, the QuickCheck docs in Test.QuickCheck contain warnings about how type defaulting in GHCi can cause types to silently default to (); all those warnings also apply to use of this function.

treeWithResult :: (forall a. Testable a => a -> IO Result) -> TestTree -> IO [Result] Source

Checks a TestTree and prints the result to standard output in addition to returning it as a list of Result. Each Decree returns a list of Result (a Single returns a single Result, while a Multi returns a Result for each test in the tree.)

Testing Decrees

decreeWithResult :: (forall a. Testable a => a -> IO Result) -> Decree -> IO [Result] Source

Tests a Decree and prints the result to standard output in addition to returning a list of Result. Each Decree returns a list of Result (a Single returns a single Result, while a Multi returns a Result for each test in the tree.)

seeDecree :: (Decree -> forall a. Testable a => a -> IO Result) -> [Decree] -> IO [[Result]] Source

Tests each Decree using a custom function that you specify; this allows you to vary the test depending on what's in the Decree. Each Decree returns a list of Result (a Single returns a single Result, while a Multi returns a Result for each test in the tree.) The tests are printed to standard output as they run, in addition to returning the Result.

Default main functions

defaultMain :: [Decree] -> IO () Source

Tests each Decree and prints the results to standard output. Exits successfully if all tests succeeded; otherwise, exits unsuccessfully.

Not recommended for REPL use as this function will either kill your REPL when it's done or, in the case of recent GHC versions, issue an exception.

defaultMainWith :: Args -> [Decree] -> IO () Source

Like defaultMain but allows you to pass arguments to the QuickCheck driver.

Not recommended for REPL use as this function will either kill your REPL when it's done or, in the case of recent GHC versions, issue an exception.

Summarizing

summarize :: [Result] -> Summary Source

Tallies up the Results.

exitCode :: Summary -> ExitCode Source

Exit successfully if there were no failures, give-ups, or no-expected-failures; otherwise, exit unsuccessfully.