Skip to content

Assert

mash.assert · Utilities

assert.contains(tag: string, haystack: mixed, needle: mixed) → bool

A string contains text, or a list/collection holds a value (typed).

assert.equal(tag: string, actual: mixed, expected: mixed) → bool

Typed equality (see the class note).

assert.isFalse(tag: string, value: mixed) → bool

No description yet.

assert.isNull(tag: string, value: mixed) → bool

No description yet.

assert.isTrue(tag: string, value: mixed) → bool

No description yet.

assert.near(tag: string, actual: mixed, expected: mixed, tolerance?: float = 0.000001) → bool

Numbers within $tolerance of each other (floating point).

assert.notEqual(tag: string, actual: mixed, unexpected: mixed) → bool

No description yet.

assert.notNull(tag: string, value: mixed) → bool

No description yet.

assert.throws(tag: string, block: mixed, messageContains?: string) → bool

The block raises an error, and its message contains $messageContains when given. Errors a statement records (mash.error) count as well as ones that end the block, and are cleared afterwards so they do not leak into the test. A time limit is never caught.

assert.unreachable(tag: string, why?: string = "") → bool

Fail unconditionally, on a branch that should not be reached (fail is a keyword).