OxL Reference

kw once

Contextual keyword — mock (§18.3)

The list of words: §1.4

Syntax

ebnf
MockResp    = Expr [ "once" | "times" Expr | "always" ] ;

Grammar: App. A

Defined in

  • 1.4 Keywords — Reserved (cannot be used as names)
  • 18.3 Mocks — mock S { … } replaces a service, interface or actor within a test.

Examples

oxl
mock Payments {
  charge(_)            => fail Timeout once, then Receipt{ id: 1 }
  refund(id) if id > 0 => Ok always
}
assert Payments.calls(.charge).count == 2

— 18.3 Mocks

Related diagnostics

mock-decl

See also