Scriptorium.Nib.Assertion
Declared Modules
Types
- AssertionState
- State threaded through an assertion chain.
- Assertion
- An assertion that transforms the subject from
'ato'b. - Assertion
- Shorthand for an assertion that does not change the subject type.
Functions
Runs an assertion chain against the given subject.
Parameterssubject : ‘a
The value under test.
assertion : Assertion<‘a, ‘b>
The assertion chain to execute.
assertion
The primitive building block for custom assertions.
Parameterspredicate : (‘a -> bool)
Returns true when the assertion passes.
message : (‘a -> string)
Formats the error message from the subject when the assertion fails.
state : AssertionState<‘a>
Changes the subject under test by applying a projection.
Parametersprojection : (‘a -> ‘b)
Transforms the current subject into a new one.
state : AssertionState<‘a>
inside
Runs a sub-assertion on a projected value while preserving the original subject for assertions that follow in the outer chain.
Parametersprojection : (‘a -> ‘b)
Extracts the inner value to assert against.
inner : Assertion<‘b, ‘c>
The assertion chain to run on the projected value.
state : AssertionState<‘a>
Marks all following assertions in the chain with a named prefix.
Parametersname : string
The tag label to prepend to failure messages.
state : AssertionState<‘a>
Wraps an assertion so that, if it fails, the rest of the chain is aborted.
Parametersinner : Assertion<‘a>
The assertion to force-stop the chain on failure.
state : AssertionState<‘a>
Inverts an assertion — passes when inner fails, fails when inner passes.
Alias for <c>not’</c> — use when the apostrophe is inconvenient in a pipeline.
Asserts the subject equals the expected value.
Asserts the subject does not equal the expected value.
Asserts the subject is greater than the threshold.
Asserts the subject is greater than or equal to the threshold.
Asserts the subject is less than the threshold.
Asserts the subject is less than or equal to the threshold.
Asserts the subject satisfies an arbitrary predicate.
Asserts the thunk throws an exception.
ReturnsAn Assertion<unit -> unit, exn> that shifts the subject to the caught exception.
Asserts the thunk throws an exception whose message equals expected.
expected : string
The exact message the exception must carry.
Asserts the thunk does not throw any exception.
Asserts the list has exactly the given number of elements.
Asserts the list contains the given element.
Asserts the list does not contain the given element.
Asserts the list starts with the given prefix.
Asserts the list has the same length as another list.
Asserts the list contains the same elements in the same order.