OxL Reference

error test-decl

error Standard: [§18.1]

What it means#

The form of a test is attributes* test kind? "name" (params)? (with env, …)? (seeds range)? { body } (§18.1, D-7060). The compiler (in oxl test builds) reports this diagnostic when

  • a test other than test fuzz has parameters — only a fuzz test's parameters are generated (D-7060);
  • a fuzz parameter has a default value or is variadic / lazy (it must be name: Type);
  • with schema(old: …) is used outside a test contract, or its old: is not a string (a version such as 0.3.0, published, or a path to an oxl.schema.lock, D-7070).

A fuzz parameter type must also be serializable (Serializable, §9.1): the generator follows the serialization schema of the type; other types are rejected by the ordinary bound check of oxlFuzzArg<T: Serializable>.

Example#

oxl✓ checked in CI
test "sum" (x: i64) { assert x + 0 == x }            // <- test-decl: write `test fuzz "sum" (x: i64)`
test "compat" with schema(old: "v1.lock") { }         // <- test-decl: `schema(…)` is for `test contract`
error
test-decl

How to fix#

oxl✓ checked in CI
test fuzz "sum" (x: i64) { assert x + 0 == x }
test contract "compat" with schema(old: "v1.lock") as old {
  assert old.roundtrip(&Order{ id: 1 }).id == 1
}

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides