mock icon indicating copy to clipboard operation
mock copied to clipboard

proposoal: NewController() should take options

Open poy opened this issue 7 years ago • 7 comments

There are a few features that would be best if they were opt in, whether this be for backwards compatibility or simply preference.

An established pattern for configuring something beyond sane defaults is a variadic list of options (see grpc-go for an example).

NewController(t TestReporter, opts ...ControllerOption){
 // ...
}

poy avatar Nov 30 '18 21:11 poy

Can this issue be closed?

msabramo avatar Aug 14 '19 00:08 msabramo

@balshetzer This opens the door to add some nice improvements to the error messages, which has been very difficult for my team to grok after we switched from a super basic in house mocking system. We were hoping to make some improvements, but many of the open pull requests do not seem to get any attention. Can you provide any clarity on how to move PRs through and if we were to invest in some changes, could we do so and see PRs merged or is there just not enough time for whoever is managing this project?

profsmallpine avatar Sep 27 '19 00:09 profsmallpine

@profsmallpine Please feel free to open an issue to discuss and propose what you are needing. From there, we should be able to sort out what PRs we should do.

I'm going to start carving out more time to ensure PRs aren't just sitting :)

poy avatar Sep 27 '19 18:09 poy

@msabramo This has not actually been fixed yet. The commit referencing this issue was in poy/mock and not golang. I wasn't happy with it, so I never made the PR.

poy avatar Sep 27 '19 18:09 poy

@poy Did you have examples of options that you would like to see?

codyoss avatar Feb 28 '20 21:02 codyoss

A few that come to mind:

  • Reversing the order in which mocks are registered (to match gmock for example)
  • Reporting styles (verbose vs quiet)

poy avatar Feb 28 '20 23:02 poy

Example of an option: #246

codyoss avatar Mar 04 '20 16:03 codyoss