OxL Reference

18.2 Assertions and fixtures

  • assert expr is executed in all profiles, including prod (profiles switch off only contracts, §6.7, and the output of dbg, §2.2); on failure it prints the values of all subexpressions; assert expr, "message"; assert x is T; assert_fails(expr, E); assert_snapshot(value) — comparison with a snapshot in snapshots/.
  • A fixture:
oxl
fixture tempDb() -> Db {
  let d = Db.open("sqlite::memory:")
  yield d                    // the test runs here
  d.close()
}

test "insert" with tempDb as db { db.insert(order) }
  • integ environments: cluster(nodes: n, roles: […]?, db: .Builtin | url); overriding dependencies: provide Payments = FakePayments{} inside a test.

fixture-yield

See also

Source: docs/spec/oxl-standard.en.md