summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/mock/mockgen/tests/unexported_method
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang/mock/mockgen/tests/unexported_method')
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/unexported_method/README.md1
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport.go15
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_mock.go45
-rw-r--r--vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_test.go17
4 files changed, 78 insertions, 0 deletions
diff --git a/vendor/github.com/golang/mock/mockgen/tests/unexported_method/README.md b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/README.md
new file mode 100644
index 0000000..87f91d4
--- /dev/null
+++ b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/README.md
@@ -0,0 +1 @@
+From #52, this tests an unexported method in the mocked interface.
diff --git a/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport.go b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport.go
new file mode 100644
index 0000000..91d5baf
--- /dev/null
+++ b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport.go
@@ -0,0 +1,15 @@
+//go:generate mockgen -destination bugreport_mock.go -package bugreport -source=bugreport.go Example
+
+package bugreport
+
+import "fmt"
+
+// Example is an interface with a non exported method
+type Example interface {
+ someMethod(string) string
+}
+
+// CallExample is a simple function that uses the interface
+func CallExample(e Example) {
+ fmt.Println(e.someMethod("test"))
+}
diff --git a/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_mock.go b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_mock.go
new file mode 100644
index 0000000..8ba218f
--- /dev/null
+++ b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_mock.go
@@ -0,0 +1,45 @@
+// 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
+}
+
+// someMethod mocks base method
+func (m *MockExample) someMethod(arg0 string) string {
+ ret := m.ctrl.Call(m, "someMethod", arg0)
+ ret0, _ := ret[0].(string)
+ return ret0
+}
+
+// someMethod indicates an expected call of someMethod
+func (mr *MockExampleMockRecorder) someMethod(arg0 interface{}) *gomock.Call {
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "someMethod", reflect.TypeOf((*MockExample)(nil).someMethod), arg0)
+}
diff --git a/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_test.go b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_test.go
new file mode 100644
index 0000000..d428fb4
--- /dev/null
+++ b/vendor/github.com/golang/mock/mockgen/tests/unexported_method/bugreport_test.go
@@ -0,0 +1,17 @@
+package bugreport
+
+import (
+ "testing"
+
+ "github.com/golang/mock/gomock"
+)
+
+func TestCallExample(t *testing.T) {
+ ctrl := gomock.NewController(t)
+ defer ctrl.Finish()
+
+ e := NewMockExample(ctrl)
+ e.EXPECT().someMethod(gomock.Any()).Return("it works!")
+
+ CallExample(e)
+}