Karya, built on Sun Nov 26 01:04:37 PST 2017 (patch 0a920b2bde70c0cbac8ee09d158064798b61bbe5)

Safe HaskellNone

Util.Testing

Contents

Description

Basic testing utilities.

Synopsis

Documentation

data Config Source #

Constructors

Config 

Fields

Instances

assertions

equal :: (CallStack.Stack, Show a, Eq a) => a -> a -> IO.IO Bool Source #

equal_fmt :: (CallStack.Stack, Eq a, Show a) => (a -> Text) -> a -> a -> IO.IO Bool Source #

right_equal :: (CallStack.Stack, Show err, Show a, Eq a) => Either err a -> a -> IO.IO Bool Source #

not_equal :: (CallStack.Stack, Show a, Eq a) => a -> a -> IO.IO Bool Source #

strings_like :: forall txt. (CallStack.Stack, TextLike txt) => [txt] -> [Pattern] -> IO.IO Bool Source #

Strings in the first list match patterns in the second list, using pattern_matches.

left_like :: (CallStack.Stack, Show a, TextLike txt) => Either txt a -> Pattern -> IO.IO Bool Source #

It's common for Left to be an error msg, or be something that can be converted to one.

match :: (CallStack.Stack, TextLike txt) => txt -> Pattern -> IO.IO Bool Source #

type Pattern = Text Source #

Pattern as matched by pattern_matches.

exception assertions

throws :: (CallStack.Stack, Show a) => a -> Pattern -> IO.IO Bool Source #

The given pure value should throw an exception that matches the predicate.

io assertions

io_human :: CallStack.Stack => String -> IO.IO a -> IO.IO a Source #

Only a human can check these things.

low level

success :: CallStack.Stack => Text -> IO.IO Bool Source #

Print a msg with a special tag indicating a passing test.

failure :: CallStack.Stack => Text -> IO.IO Bool Source #

Print a msg with a special tag indicating a failing test.

extracting

QuickCheck

quickcheck :: (CallStack.Stack, Testable prop) => prop -> IO.IO Bool Source #

Run a quickcheck property.

q_equal :: (Show a, Eq a) => a -> a -> Property Source #

equal for quickcheck.

profiling

timer :: IO.IO a -> IO.IO (a, Double, Double) Source #

Run an action and report the time in CPU seconds and wall clock seconds.

print_timer :: String -> (Double -> Double -> a -> String) -> IO.IO a -> IO.IO a Source #

pretty printing

pprint :: Show a => a -> IO.IO () Source #

filesystem

unique_tmp_dir :: String -> IO.IO IO.FilePath Source #

Get a tmp dir, which will be unique for each test run.

tmp_dir :: String -> IO.IO IO.FilePath Source #

Get a tmp dir, which is the same on each test run.

tmp_base_dir :: IO.FilePath Source #

All tmp files used by tests should go in this directory. TODO instead of being hardcoded this should be configured per-project.