Skip to content

Commit

Permalink
comments in method body removed, condition refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
sleygin committed May 13, 2024
1 parent 5a7baf8 commit 22e5586
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 108 deletions.
5 changes: 1 addition & 4 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const (
}
{{end}}
// Times sets number of times {{$.Interface.Name}}.{{$method.Name}} should be invoked
func ({{$m}} *m{{$mock}}{{$method.Name}}{{(paramsRef)}}) Times(n uint64) *m{{$mock}}{{$method.Name}}{{(paramsRef)}} {
if n == 0 {
{{$m}}.mock.t.Fatalf("Times of {{$mock}}.{{$method.Name}} mock can not be zero")
Expand All @@ -219,13 +220,9 @@ const (
func ({{$m}} *m{{$mock}}{{$method.Name}}{{(paramsRef)}}) invocationsDone() bool {
if len({{$m}}.expectations) == 0 && {{$m}}.defaultExpectation == nil && {{$m}}.mock.func{{$method.Name}} == nil {
// does not need to check invocations if no expectations, defaultExpectation or func{{$method.Name}} set
return true
}
// if expectations were set we check total invocations
// if default expectation was set then invocations count should be greater than zero
// if func was set then invocations count should be greater than zero
totalInvocations := mm_atomic.LoadUint64(&{{$m}}.mock.after{{$method.Name}}Counter)
expectedInvocations := mm_atomic.LoadUint64(&{{$m}}.expectedInvocations)
Expand Down
5 changes: 1 addition & 4 deletions tests/actor_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions tests/context_accepter_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/formatter_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_complex_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_in.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_inline_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_inline_with_many_options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_inout.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_multiple_args_with_different_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_simple_union.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions tests/generic_specific.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 22e5586

Please sign in to comment.