Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Util.Testing

Contents

Description

Basic testing utilities.

Synopsis

Documentation

data Config Source #

Constructors

Config 

Fields

Instances

assertions

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

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

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

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

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

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

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

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

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

exception assertions

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

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

io assertions

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

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

Only a human can check these things.

low level

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

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

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

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

extracting

expect_right :: (Stack, Show a) => Either a b -> b Source #

error_stack :: Stack => String -> a Source #

Like error, but with the caller's position.

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.