Commit Graph

15 Commits

Author SHA1 Message Date
Suhas Karanth
2ae606f132
Internal registry for disambiguated imports, vars (#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.
2021-02-01 19:20:20 +00:00
Suhas Karanth
720d53e65d Run go generate
Minor changes to generated test file because of c5b1da6 (#128).
2020-08-16 16:55:11 +05:30
Mat Ryer
7855d5d508
Merge branch 'master' into static-interface-check 2019-01-21 17:15:50 +00:00
Lucas Bremgartner
b21592468b Add static interface implementation check
Add an additional line of code per interface to the generated mock file,
which allows the go compiler to statically check if the mock implements
the mocked interface.
2019-01-17 20:20:37 +01:00
Lucas Bremgartner
2eb3df732a Update mocks with go generate 2019-01-17 20:19:34 +01:00
Lucas Bremgartner
f70153ef95 Update files generated by moq 2018-06-12 13:40:29 +02:00
Lucas Bremgartner
6af989dedc Implement "DO NOT EDIT" comment convention
Update all generated files with `go generate ./...`.

See golang/go#13560 for details.
2018-04-18 09:38:43 +02:00
Mat Ryer
941b573418 Go fmt 2017-07-11 21:42:55 +01:00
Mat Ryer
9dfde8fc79 Improved the way calls and locks work 2017-07-11 21:27:08 +01:00
Mat Ryer
b76739db6c improved report card 2016-11-06 12:37:57 +00:00
Mat Ryer
4741efe1e6 minor tweaks 2016-10-14 10:57:57 +01:00
Mat Ryer
92c01adec9 added test to prove variadic args aren't working 2016-10-06 11:24:08 +01:00
Mat Ryer
99a46df581 tweaks 2016-08-31 13:05:37 +01:00
Mat Ryer
da0b19b274 improved output 2016-08-29 13:09:34 +01:00
Mat Ryer
6a2af83edc early commit for moq command 2016-08-29 13:00:18 +01:00