summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict')
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md26
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport.go16
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_mock.go58
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_test.go26
4 files changed, 0 insertions, 126 deletions
diff --git a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
deleted file mode 100644
index ffb5f9f..0000000
--- a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
-The generated mock methods use some hardcoded variable/receiver names that can
-have conflicts with the argument names that are defined by the code for which
-the mock is generated when using the source generation method.
-
-Example:
-
-```go
-type Example interface {
- Method(_m, _mr, m, mr int)
-}
-```
-
-```go
-// Method mocks base method
-func (_m *MockExample) Method(_m int, _mr int, m int, mr int) {
- _m.ctrl.Call(_m, "Method", _m, _mr, m, mr)
-}
-```
-
-In the above example one of the interface method parameters is called `_m`
-but unfortunately the generated receiver name is also called `_m` so the
-mock code won't compile.
-
-The generator has to make sure that generated identifiers (e.g.: the receiver
-names) are always different from the arg names that might come from external
-sources.
diff --git a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport.go b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport.go
deleted file mode 100644
index 77af43d..0000000
--- a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport.go
+++ /dev/null
@@ -1,16 +0,0 @@
-//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go
-
-package bugreport
-
-type Example interface {
- // _m and _mr were used by the buggy code: the '_' prefix was there hoping
- // that no one will use method argument names starting with '_' reducing
- // the chance of collision with generated identifiers.
- // m and mr are used by the bugfixed new code, the '_' prefix has been
- // removed because the new code generator changes the names of the
- // generated identifiers in case they would collide with identifiers
- // coming from argument names.
- Method(_m, _mr, m, mr int)
-
- VarargMethod(_s, _x, a, ret int, varargs ...int)
-}
diff --git a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_mock.go b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_mock.go
deleted file mode 100644
index 114f967..0000000
--- a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_mock.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by MockGen. DO NOT EDIT.
-// Source: bugreport.go
-
-// Package bugreport is a generated GoMock package.
-package bugreport
-
-import (
- gomock "github.com/golang/mock/gomock"
- reflect "reflect"
-)
-
-// MockExample is a mock of Example interface
-type MockExample struct {
- ctrl *gomock.Controller
- recorder *MockExampleMockRecorder
-}
-
-// MockExampleMockRecorder is the mock recorder for MockExample
-type MockExampleMockRecorder struct {
- mock *MockExample
-}
-
-// NewMockExample creates a new mock instance
-func NewMockExample(ctrl *gomock.Controller) *MockExample {
- mock := &MockExample{ctrl: ctrl}
- mock.recorder = &MockExampleMockRecorder{mock}
- return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use
-func (m *MockExample) EXPECT() *MockExampleMockRecorder {
- return m.recorder
-}
-
-// Method mocks base method
-func (m_2 *MockExample) Method(_m, _mr, m, mr int) {
- m_2.ctrl.Call(m_2, "Method", _m, _mr, m, mr)
-}
-
-// Method indicates an expected call of Method
-func (mr_2 *MockExampleMockRecorder) Method(_m, _mr, m, mr interface{}) *gomock.Call {
- return mr_2.mock.ctrl.RecordCallWithMethodType(mr_2.mock, "Method", reflect.TypeOf((*MockExample)(nil).Method), _m, _mr, m, mr)
-}
-
-// VarargMethod mocks base method
-func (m *MockExample) VarargMethod(_s, _x, a, ret int, varargs ...int) {
- varargs_2 := []interface{}{_s, _x, a, ret}
- for _, a_2 := range varargs {
- varargs_2 = append(varargs_2, a_2)
- }
- m.ctrl.Call(m, "VarargMethod", varargs_2...)
-}
-
-// VarargMethod indicates an expected call of VarargMethod
-func (mr *MockExampleMockRecorder) VarargMethod(_s, _x, a, ret interface{}, varargs ...interface{}) *gomock.Call {
- varargs_2 := append([]interface{}{_s, _x, a, ret}, varargs...)
- return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VarargMethod", reflect.TypeOf((*MockExample)(nil).VarargMethod), varargs_2...)
-}
diff --git a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_test.go b/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_test.go
deleted file mode 100644
index 3ca9807..0000000
--- a/vendor/github.com/golang/mock/mockgen/tests/generated_identifier_conflict/bugreport_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package bugreport
-
-import (
- "github.com/golang/mock/gomock"
- "testing"
-)
-
-func TestExample_Method(t *testing.T) {
- ctrl := gomock.NewController(t)
- m := NewMockExample(ctrl)
- m.EXPECT().Method(1, 2, 3, 4)
-
- m.Method(1, 2, 3, 4)
-
- ctrl.Finish()
-}
-
-func TestExample_VarargMethod(t *testing.T) {
- ctrl := gomock.NewController(t)
- m := NewMockExample(ctrl)
- m.EXPECT().VarargMethod(1, 2, 3, 4, 6, 7)
-
- m.VarargMethod(1, 2, 3, 4, 6, 7)
-
- ctrl.Finish()
-}