ilusm.dev

test

Test runner, assertions, coverage, mocking.

Load with: use test

Quick example

use test

result = tstde("value", 10, \(x) x)
prn(result)

Functions

Test runner

tstru()

Runs.

tstde(r, nm, cb)

Decodes. Takes r, nm, cb.

tstit(s, nm, cb)

Performs the operation. Takes s, nm, cb.

tstbe(sr, cb)

Performs the operation. Takes sr, cb.

tstae(sr, cb)

Performs the operation. Takes sr, cb.

Assertions

asseq(act, exp, msg)

Performs the operation. Takes act, exp, msg.

assne(act, nexp, msg)

Creates a new instance. Takes act, nexp, msg.

asstr(v, msg)

Performs the operation. Takes v, msg.

assfl(v, msg)

Performs the operation. Takes v, msg.

assni(v, msg)

Performs the operation. Takes v, msg.

assnn(v, msg)

Performs the operation. Takes v, msg.

assth(cb, eerr, msg)

Performs the operation. Takes cb, eerr, msg.

assae(act, exp, tol, msg)

Performs the operation. Takes act, exp, tol, msg.

assco(col, it, msg)

Connects. Takes col, it, msg.

assma(sv, pat, msg)

Performs the operation. Takes sv, pat, msg.

Running tests

tstru1(runner, opts)

Performs the operation. Takes runner, opts.

Test reporting

tstrp(res)

Performs the operation. Takes res.

Coverage

tetst(mp)

Sets a value or starts a process. Takes mp.

tesin(src)

Initialises. Takes src.

tstrw(t, cov)

Performs the operation. Takes t, cov.

tetst1(cov)

Performs the operation. Takes cov.

__tcovln(file, line)

Performs the operation. Takes file, line.

__tcovbr(file, line, branch)

Performs the operation. Takes file, line, branch.

Mocking

tstmo()

Performs the operation.

tstmk(m, rv)

Creates a new instance. Takes m, rv.

tstmk1(m, cb)

Performs the operation. Takes m, cb.

mockf(m)

Performs the operation. Takes m.

tstmk2(m)

Performs the operation. Takes m.

tstmk3(m, args)

Performs the operation. Takes m, args.

Spies

tests(target, method)

Performs the operation. Takes target, method.

Fixtures

testf(nm, cb)

Performs the operation. Takes nm, cb.

testu(nm)

Performs the operation. Takes nm.

Snapshot testing

tstsn(v, nm)

Performs the operation. Takes v, nm.

Property-based testing (QuickCheck style)

tstfo(gen, prop, itr)

Formats. Takes gen, prop, itr.

Benchmarking

tstbc(nm, cb, itr)

Performs the operation. Takes nm, cb, itr.

tstbc1(res)

Performs the operation. Takes res.

Test file discovery

tstdi(dir)

Disconnects. Takes dir.

CLI runner

tstma()

Performs the operation.

Notes

  • Test framework - define tests, assertions, suites, reporters.