Repository navigation
This release makes it possible to create stubs that return a placeholder value until they’re configured, so that a test that calls an unconfigured stub fails instead of crashing.
- The new
DefaultStubValueProvidingprotocol lets a type provide a default value for stubs that return it. DevTesting conforms common standard library and Foundation types, includingArray,Bool,Data,Date,Dictionary, floating point and integer types,Optional,Set,String,URL, andUUID. Stubhas a newinit()that returns the default stub value until configured, available when its return type conforms toDefaultStubValueProviding.ThrowingStubhas a newinit()for stubs whose error type isany Error. It throws an unspecified error until configured.- The new
ArbitraryErrortype is an error for tests that just need an error to throw.RandomValueGeneratinghas a newrandomError(fileID:function:)function that creates one with a random description beginning with the calling file and function. If your tests already extendRandomValueGeneratingwith a function namedrandomError, you may need to rename or remove it to avoid ambiguous calls.