Std.Test.each
1 declaration
fn
each: &Array[T] -> fn(T) -> Str -> fn(T) -> Bool -> Array[Std.Test.Check]This is a callable function.
What it does
The same check over a table of cases.
Each case answers its own name and its own check, so a table of twenty
inputs is twenty named checks rather than one check that stops at the first
input it dislikes. A failure names the case, which is what makes a table
worth having: the reader is told which row broke.
The name comes from a function rather than a template with holes in it.
A template would be a small unchecked language inside a string — the same
thing [[Std Fmt]] refuses — and a function is checked, can say anything about
the case, and cannot disagree with the case's type.
Read the signature
- The text after the name is the type checked by Pudu.
- Read arrows from left to right: inputs come first, and the final type is returned.
- & borrows a value for this call instead of moving or copying it.
- Names inside [ ] are type arguments, such as the item type held by a collection.
