generate

package
v0.0.0-...-fd94602 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyInterface

type MyInterface[T any] interface {
	One(T) bool
	Two() int
	Three() string
}

MyInterface is a test interface.

type MyInterfaceString

type MyInterfaceString = MyInterface[string]

type MyInterfaceStringMock

type MyInterfaceStringMock struct {
	// OneFunc mocks the One method.
	OneFunc func(s string) bool

	// ThreeFunc mocks the Three method.
	ThreeFunc func() string

	// TwoFunc mocks the Two method.
	TwoFunc func() int
	// contains filtered or unexported fields
}

MyInterfaceStringMock is a mock implementation of MyInterfaceString.

func TestSomethingThatUsesMyInterfaceString(t *testing.T) {

	// make and configure a mocked MyInterfaceString
	mockedMyInterfaceString := &MyInterfaceStringMock{
		OneFunc: func(s string) bool {
			panic("mock out the One method")
		},
		ThreeFunc: func() string {
			panic("mock out the Three method")
		},
		TwoFunc: func() int {
			panic("mock out the Two method")
		},
	}

	// use mockedMyInterfaceString in code that requires MyInterfaceString
	// and then make assertions.

}

func (*MyInterfaceStringMock) One

func (mock *MyInterfaceStringMock) One(s string) bool

One calls OneFunc.

func (*MyInterfaceStringMock) OneCalls

func (mock *MyInterfaceStringMock) OneCalls() []struct {
	S string
}

OneCalls gets all the calls that were made to One. Check the length with:

len(mockedMyInterfaceString.OneCalls())

func (*MyInterfaceStringMock) Three

func (mock *MyInterfaceStringMock) Three() string

Three calls ThreeFunc.

func (*MyInterfaceStringMock) ThreeCalls

func (mock *MyInterfaceStringMock) ThreeCalls() []struct {
}

ThreeCalls gets all the calls that were made to Three. Check the length with:

len(mockedMyInterfaceString.ThreeCalls())

func (*MyInterfaceStringMock) Two

func (mock *MyInterfaceStringMock) Two() int

Two calls TwoFunc.

func (*MyInterfaceStringMock) TwoCalls

func (mock *MyInterfaceStringMock) TwoCalls() []struct {
}

TwoCalls gets all the calls that were made to Two. Check the length with:

len(mockedMyInterfaceString.TwoCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL