-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add github.com/matryer/moq style mocks into mockery #725
base: master
Are you sure you want to change the base?
Commits on Dec 23, 2023
-
Internal registry for disambiguated imports, vars (vektra#141)
* Internal registry for disambiguated imports, vars - Move functionality in the moq package partially into internal/{registry,template}. - Leverage registry to assign unique package and variable/method parameter names. Use import aliases if present in interface source package. BREAKING CHANGE: When the interface definition does not mention the parameter names, the field names in call info anonymous struct will be different. The new field names are generated using the type info (string -> s, int -> n, chan int -> intCh, []MyType -> myTypes, map[string]int -> stringToInt etc.). For example, for a string parameter previously if the field name was 'In1', the new field could be 'S' or 'S1' (depends on number of string method parameters). * Refactor golden file tests to be table-driven * Fix sync pkg alias handling for moq generation * Improve, add tests (increase coverage) * Use $.Foo in template, avoid declaring variables $ is set to the data argument passed to Execute, that is, to the starting value of dot. Variables were declared to be able to refer to the parent context. * Consistent template field formatting * Use tabs in generated Godoc comments' example code * Minor simplification * go generate * Fix conflict for generated param name of pointer type Excellent work by @sudo-suhas.
Configuration menu - View commit details
-
Copy full SHA for e06c157 - Browse repository at this point
Copy the full SHA e06c157View commit details -
feat: support generic interface generation (vektra#175)
Allow the generation of mocks for generics as introduced in golang 1.18
Configuration menu - View commit details
-
Copy full SHA for 36a85ce - Browse repository at this point
Copy the full SHA 36a85ceView commit details -
Go version independent moq output with consistent whitespace
By tweaking whitespace in template
Configuration menu - View commit details
-
Copy full SHA for d1b2fd4 - Browse repository at this point
Copy the full SHA d1b2fd4View commit details -
Add flag to enable mock reset methods (vektra#181)
The optional with-resets flag adds methods to reset method calls. Calls can be reset individually or all at once with these.
Configuration menu - View commit details
-
Copy full SHA for d411b15 - Browse repository at this point
Copy the full SHA d411b15View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0028a34 - Browse repository at this point
Copy the full SHA 0028a34View commit details -
Internal registry for disambiguated imports, vars (vektra#141)
* Internal registry for disambiguated imports, vars - Move functionality in the moq package partially into internal/{registry,template}. - Leverage registry to assign unique package and variable/method parameter names. Use import aliases if present in interface source package. BREAKING CHANGE: When the interface definition does not mention the parameter names, the field names in call info anonymous struct will be different. The new field names are generated using the type info (string -> s, int -> n, chan int -> intCh, []MyType -> myTypes, map[string]int -> stringToInt etc.). For example, for a string parameter previously if the field name was 'In1', the new field could be 'S' or 'S1' (depends on number of string method parameters). * Refactor golden file tests to be table-driven * Fix sync pkg alias handling for moq generation * Improve, add tests (increase coverage) * Use $.Foo in template, avoid declaring variables $ is set to the data argument passed to Execute, that is, to the starting value of dot. Variables were declared to be able to refer to the parent context. * Consistent template field formatting * Use tabs in generated Godoc comments' example code * Minor simplification * go generate * Fix conflict for generated param name of pointer type Excellent work by @sudo-suhas.
Configuration menu - View commit details
-
Copy full SHA for d16ef1b - Browse repository at this point
Copy the full SHA d16ef1bView commit details -
Fix var name generation to avoid conflict (vektra#145)
When the type and the package name is the same for an anonymous parameter (ex: time.Time), and there are more than 1 such parameters, the generated name for both was the same. And the generated code would not be valid. Fix the bug by ensuring the parameter name does not conflict with package imports first before checking against other parameter names.
Configuration menu - View commit details
-
Copy full SHA for 5ea7cda - Browse repository at this point
Copy the full SHA 5ea7cdaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c9d05c - Browse repository at this point
Copy the full SHA 2c9d05cView commit details -
Fix issue with custom types shadowing basic types (vektra#163)
When a custom type has a name that can shadow an in-built type, append MoqParam to the name. Example: var name stringMoqParam for null.String.
Configuration menu - View commit details
-
Copy full SHA for 9e0e5d0 - Browse repository at this point
Copy the full SHA 9e0e5d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 92a6e93 - Browse repository at this point
Copy the full SHA 92a6e93View commit details -
feat: support generic interface generation (vektra#175)
Allow the generation of mocks for generics as introduced in golang 1.18
Configuration menu - View commit details
-
Copy full SHA for 4468afa - Browse repository at this point
Copy the full SHA 4468afaView commit details -
Recursively check unique pkg names against existing imports
When we generate a unique name for pkg a on conflict with pkg b, the new name could already be in use for pkg c. So recursively check each unique name against existing imports before setting it.
Configuration menu - View commit details
-
Copy full SHA for fb12cf9 - Browse repository at this point
Copy the full SHA fb12cf9View commit details -
Configuration menu - View commit details
-
Copy full SHA for ebe7652 - Browse repository at this point
Copy the full SHA ebe7652View commit details -
Do not load unnecessary package information (vektra#203)
- Add benchmark test for registry.New
Configuration menu - View commit details
-
Copy full SHA for 222a8a9 - Browse repository at this point
Copy the full SHA 222a8a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d04e7d - Browse repository at this point
Copy the full SHA 1d04e7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e68ee26 - Browse repository at this point
Copy the full SHA e68ee26View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3eb17fe - Browse repository at this point
Copy the full SHA 3eb17feView commit details -
Configuration menu - View commit details
-
Copy full SHA for 860c2c8 - Browse repository at this point
Copy the full SHA 860c2c8View commit details -
Add more code to plumb through all the values needed by moq registry …
…methods In this commit, we gather all the template data needed by the moq logic to generate its template. This is untested as of yet. TODO: need to start testing this works by calling upon `moq` in `.mockery.yaml`.
Configuration menu - View commit details
-
Copy full SHA for d66be2c - Browse repository at this point
Copy the full SHA d66be2cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1edd82f - Browse repository at this point
Copy the full SHA 1edd82fView commit details -
Configuration menu - View commit details
-
Copy full SHA for f19f1f1 - Browse repository at this point
Copy the full SHA f19f1f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 852b19e - Browse repository at this point
Copy the full SHA 852b19eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d89443 - Browse repository at this point
Copy the full SHA 9d89443View commit details
Commits on Feb 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 9aa5b53 - Browse repository at this point
Copy the full SHA 9aa5b53View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f078dc - Browse repository at this point
Copy the full SHA 1f078dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for e3fe47c - Browse repository at this point
Copy the full SHA e3fe47cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 62ef480 - Browse repository at this point
Copy the full SHA 62ef480View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d37c18 - Browse repository at this point
Copy the full SHA 5d37c18View commit details
Commits on Feb 13, 2024
-
Move generator to separate package
Disable generating mocks for functions in templated mocks
Configuration menu - View commit details
-
Copy full SHA for f9bee27 - Browse repository at this point
Copy the full SHA f9bee27View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2ded465 - Browse repository at this point
Copy the full SHA 2ded465View commit details -
Configuration menu - View commit details
-
Copy full SHA for f144fb5 - Browse repository at this point
Copy the full SHA f144fb5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a1905b - Browse repository at this point
Copy the full SHA 4a1905bView commit details -
Configuration menu - View commit details
-
Copy full SHA for d25b5da - Browse repository at this point
Copy the full SHA d25b5daView commit details -
Configuration menu - View commit details
-
Copy full SHA for 63653e0 - Browse repository at this point
Copy the full SHA 63653e0View commit details -
Split out warn logs to logging package
Add warning when using `moq` style
Configuration menu - View commit details
-
Copy full SHA for a0f012b - Browse repository at this point
Copy the full SHA a0f012bView commit details -
Add template-map config param.
Factor out TypeInstantiation into separate function.
Configuration menu - View commit details
-
Copy full SHA for 19b9718 - Browse repository at this point
Copy the full SHA 19b9718View commit details -
Configuration menu - View commit details
-
Copy full SHA for db5f5a6 - Browse repository at this point
Copy the full SHA db5f5a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05f2c4d - Browse repository at this point
Copy the full SHA 05f2c4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 587f197 - Browse repository at this point
Copy the full SHA 587f197View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1805cf2 - Browse repository at this point
Copy the full SHA 1805cf2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0aa59fb - Browse repository at this point
Copy the full SHA 0aa59fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for cdd540b - Browse repository at this point
Copy the full SHA cdd540bView commit details -
Configuration menu - View commit details
-
Copy full SHA for ddf4a43 - Browse repository at this point
Copy the full SHA ddf4a43View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f4d02d - Browse repository at this point
Copy the full SHA 7f4d02dView commit details
Commits on Feb 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 78eb414 - Browse repository at this point
Copy the full SHA 78eb414View commit details -
Configuration menu - View commit details
-
Copy full SHA for f0de03c - Browse repository at this point
Copy the full SHA f0de03cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a82b265 - Browse repository at this point
Copy the full SHA a82b265View commit details -
Configuration menu - View commit details
-
Copy full SHA for a9aac88 - Browse repository at this point
Copy the full SHA a9aac88View commit details -
Configuration menu - View commit details
-
Copy full SHA for f57f7b1 - Browse repository at this point
Copy the full SHA f57f7b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd61c0f - Browse repository at this point
Copy the full SHA dd61c0fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c8a2304 - Browse repository at this point
Copy the full SHA c8a2304View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37562c5 - Browse repository at this point
Copy the full SHA 37562c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ddd30b - Browse repository at this point
Copy the full SHA 4ddd30bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ff0a85 - Browse repository at this point
Copy the full SHA 8ff0a85View commit details