Kolos65 / Mockable

A Swift macro driven auto-mocking library.
MIT License
199 stars 14 forks source link

Relaxed mode #34

Closed Kolos65 closed 3 months ago

Kolos65 commented 3 months ago

Relaxed Mode

By default, you must specify a return value for all requirements; otherwise, a fatal error will be thrown. The reason for this is to aid in the discovery (and thus the verification) of every called function when writing unit tests.

However, it is common to prefer avoiding this strict default behavior in favor of a more relaxed setting, where, for example, void or optional return values do not need explicit given registration.

Use the MockerPolicy option set to implicitly mock:

You have two options to override the default strict behavior of the library:

⚠️ Relaxed mode will not work with generic functions as the type system is unable to locate the appropriate generic overload.