Structs don't convert to expectations automatically for two reasons:
- Unlike collections which may contain anything, structs often restrict the type of fields so
expect-struct is required to make expectations that expect a field of a struct matches some expectation.
- Only struct field positions are available at runtime, not accessor names. This makes it hard to produce good error messages when drilling down into struct fields.
The expect-struct combinator serves well enough for the first problem, but an expect-struct-equal? macro that combined a struct value with the accessors in a struct identifier could fix that.
Structs don't convert to expectations automatically for two reasons:
expect-structis required to make expectations that expect a field of a struct matches some expectation.The
expect-structcombinator serves well enough for the first problem, but anexpect-struct-equal?macro that combined a struct value with the accessors in a struct identifier could fix that.