Validating Functions
A function spec describes the operation of a function. It thus contains up to three specs: an “args” spec for the arguments of the function, a “ret” spec describing the return value, and a “fn” spec used to relate the arguments to the return value. Creating function specs unlocks many of the most useful capabilities of the spec library, like instrumentation and generative testing.
The argument spec defines the collection of arguments that you can use to invoke the function being spec’ed. The spec operations we’ve seen so far allowed us to create specs for collections, but we need more power to represent the broad range of variability we see in function arguments—repeated arguments, optional arguments, and other structured ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access