package alcotest
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=e2387136ca854df2b4152139dd4d4b3953a646e804948073dedfe0a232f08a15
sha512=ba38fe4a9061b001d274e5d41fb06c10c84120570fc00dc57dc5a06ba05176c2413295680d839f465ba91469ea99d7e172a324e26f005d6e8c4d98fca7657241
doc/alcotest.engine/Alcotest_engine/V1/Test/index.html
Module V1.Test
Source
Testable values
The following combinators represent types that can be used with the check
functions below.
TESTABLE
provides an abstract description for testable values.
testable pp eq
is a new testable
with the pretty-printer pp
and equality eq
.
slist t comp
tests sorted lists of t
s. The list are sorted using comp
.
result t e
tests t
s on success and e
s on failure.
triple a b c
tests triples of a
s, b
s and c
s.
of_pp pp
tests values which can be printed using pp
and compared using Stdlib.compare
neg t
is t
's negation: it is true
when t
is false
and it is false
when t
is true
.
map f t
lift a 'a testable
to a 'b testable
, converting 'b
to 'a
.
Assertion functions
Functions for asserting various properties within unit-tests. A failing assertion will cause the testcase to fail immediately.
The assertion functions optionally take information about the location at which they are called in the source code. This is used for giving more descriptive error messages in the case of failure.
check testable msg expected actual
checks that two values are equal.
msg
is printed if the check fails.
If check
isn't in a tail-call position, Alcotest may guess the location of the check. Otherwise, use extra_info
to report the location.
Check that two values are equal (labeled variant of check
).
Simply fail.
Simply fail with a formatted message.
Check that an exception is raised.
match_raises msg exception_is_expected f
Runs f ()
, and passes the raised exception to exception_is_expected
. The check fails when no exception is raised, or exception_is_expected
returns false.
Skip the current test case.