pub fn call_assertion(
name: &str,
args: &mut Vec<Value>,
sources: &[&str],
span: Span,
) -> Result<Value, RuntimeError>Expand description
assert(condition: Bool) -> Result<Unit, Error> and
assertEqual(actual: T, expected: T) -> Result<Unit, Error>.
sources holds the source text of each argument expression, in order.
That text is the whole reason these are builtins rather than a library:
a failure message says which condition failed in the words the test was
written in, and only the compiler has them.
A failing assertion is an expected failure, so it is an Err rather than
a panic — panics stay reserved for broken invariants. assertEqual
reports both values, since knowing only that they differ rarely explains
why.
How many arguments each takes and what each one is called are the shared
table’s, so the arity this enforces is the arity cove check reported on.