1\DOC assert_exn
2
3\TYPE {assert_exn : ('a -> bool) -> 'a -> exn -> 'a}
4
5\SYNOPSIS
6Checks that a value satisfies a predicate.
7
8\DESCRIBE
9{assert_exn p x e} returns {x} if the application {p x} evaluates to
10{true}. Otherwise, {assert_exn p x e} raises {e}
11
12\FAILURE
13{assert_exn p x e} fails with exception {e} if the predicate {p} yields
14{false} when applied to the value {x}. If the application {p x} raises
15an exception {ex}, then {assert_exn p x e} raises {ex}.
16
17
18
19\EXAMPLE
20{
21- null [];
22> val it = true : bool
23
24- assert_exn null ([]:int list) (Fail "non-empty list");
25> val it = [] : int list
26
27- null [1];
28> false : bool
29
30- assert_exn null [1] (Fail "non-empty list");;
31! Uncaught exception:
32! Fail  "non-empty list"
33}
34
35\SEEALSO
36Lib.can, Lib.assert.
37
38\ENDDOC
39