to me mocking is largely about ergonomics, and this is an area where i feel that Swift tends to struggle. consider the following API:
extension US
{
struct CityState:LosslessStringConvertible
{
init?(_ string:)
}
}
it’s quite difficult to write clean, readable test cases without having to force your way through layers and layers of optionals. for example, imagine writing tests for the US.CityState parser. you cannot easily express the expectations, without going through the parser/validator itself! instead, you need some kind of underscored or “unchecked” API to actually instantiate the expectations.