ilusm.dev

snap

# snap - snapshot/golden file testing.

Load with: use snap

Quick example

use snap

result = snapd("value", "value")
prn(result)

Functions

Snapshot state

snapn()

Performs the operation.

snapd(s, d)

Performs the operation. Takes s, d.

snapu(s)

Performs the operation. Takes s.

Get snapshot path for test

snapp(s, tname)

Performs the operation. Takes s, tname.

Compare or update snapshot

snapc(s, tname, got)

Performs the operation. Takes s, tname, got.

Assert snapshot matches

snapa(s, tname, got)

Parses. Takes s, tname, got.

Multi-snapshot file format

snapm(p)

Performs the operation. Takes p.

Write multi-snapshot file

snapw(p, snaps)

Performs the operation. Takes p, snaps.

Inline snapshot (for small outputs)

snapi(got, exp)

Performs the operation. Takes got, exp.

Update all snapshots in directory

snapu(d)

Performs the operation. Takes d.

Normalize for comparison (remove variable parts)

snapn(s, reps)

Performs the operation. Takes s, reps.

Common normalizations

snapt(s)

Performs the operation. Takes s.

snapu(s)

Performs the operation. Takes s.

Notes

  • Snapshot testing - capture and compare outputs.