Open mniak opened 11 months ago
I think I understand why this could reduce some hand-written function declarations if you wanted to re-use setup functions but it think that having multiple patterns for setting up mocks (one with a setup function and one without) would make mock code less uniform and make users uncertain about which approach to use (in most cases we want to reduce nesting).
From what I can tell the generated implementation would be a methods with a pointer receiver that takes in a variable with the same reference to the receiver when ideally there is one clear variable to modify.
If this is just for inline setup, would it be better to create external wrapper functions that you could call inline?
Requested feature A helper method that would make inline construction of mocks possible.
Why the feature is needed
So the test code would look nicer
Proposed solution
Maybe something like a
SETUP
method in every mock, which woul receive a function that configures the mock.Example (before):
Example (after):