OxL Reference

fn oxlContractRoundtrip

x as an old peer of the contract test's old schema reads it and writes it back (D-7071): fields and variants the old schema does not know are dropped. Panics when the old peer cannot read the value or the new reader cannot read its answer.

Example:

oxl✓ checked in CI
data Person {
  id: i64
  name: str
}

test contract "old readers understand Person" with schema(old: "published") as old {
  let p = Person{ id: 1, name: "ann" }
  assert_eq(old.roundtrip(p), p)
}
@intrinsic("test.contractRoundtrip") pub(api) fn oxlContractRoundtrip<T: Serializable>(x: &T) -> T

Since. 1.0.0-beta

Parameters

NameType
x&T

Returns

T

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/testing.oxl:358

See also