example

package
v0.0.0-...-fdc3859 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Example

type Example interface {
	NoParamsOrReturn()
	UnnamedParam(string)
	UnnamedVariadicParam(...string)
	BlankParam(_ string)
	BlankVariadicParam(_ ...string)
	NamedParam(str string)
	NamedVariadicParam(strs ...string)
	SameTypeNamedParams(str1, str2 string)
	InternalTypeParam(internal internal.Internal)
	ImportedParam(tmpl template.Template)
	ImportedVariadicParam(tmpl ...template.Template)
	RenamedImportParam(tmpl renamed.Template)
	RenamedImportVariadicParam(tmpls ...renamed.Template)
	DotImportParam(file File)
	DotImportVariadicParam(files ...File)
	SelfReferentialParam(intf Example)
	SelfReferentialVariadicParam(intf ...Example)
	StructParam(obj struct {
		// contains filtered or unexported fields
	})
	StructVariadicParam(objs ...struct{ num int })
	EmbeddedStructParam(obj struct {
		// contains filtered or unexported fields
	})
	EmbeddedStructVariadicParam(objs ...struct{ int })
	EmptyInterfaceParam(intf interface{})
	EmptyInterfaceVariadicParam(intf ...interface{})
	InterfaceParam(intf interface {
		MyFunc(num int) error
	})
	InterfaceVariadicParam(intf ...interface {
		MyFunc(num int) error
	})
	InterfaceVariadicFuncParam(intf interface {
		MyFunc(nums ...int) error
	})
	InterfaceVariadicFuncVariadicParam(intf ...interface {
		MyFunc(nums ...int) error
	})
	EmbeddedInterfaceParam(intf interface {
		fmt.Stringer
	})

	UnnamedReturn() error
	MultipleUnnamedReturn() (int, error)
	BlankReturn() (_ error)
	NamedReturn() (err error)
	SameTypeNamedReturn() (err1, err2 error)
	RenamedImportReturn() (tmpl renamed.Template)
	DotImportReturn() (file File)
	SelfReferentialReturn() (intf Example)
	StructReturn() (obj struct {
		// contains filtered or unexported fields
	})
	EmbeddedStructReturn() (obj struct {
		// contains filtered or unexported fields
	})
	EmptyInterfaceReturn() (intf interface{})
	InterfaceReturn() (intf interface {
		MyFunc(num int) error
	})
	InterfaceVariadicFuncReturn() (intf interface {
		MyFunc(nums ...int) error
	})
	EmbeddedInterfaceReturn() (intf interface {
		fmt.Stringer
	})
}

Example is an example interface with a large number of methods of different signatures.

type ExampleMock

type ExampleMock struct {
	T                                  *testing.T
	NoParamsOrReturnStub               func()
	NoParamsOrReturnCalled             int32
	UnnamedParamStub                   func(string)
	UnnamedParamCalled                 int32
	UnnamedVariadicParamStub           func(...string)
	UnnamedVariadicParamCalled         int32
	BlankParamStub                     func(_ string)
	BlankParamCalled                   int32
	BlankVariadicParamStub             func(_ ...string)
	BlankVariadicParamCalled           int32
	NamedParamStub                     func(str string)
	NamedParamCalled                   int32
	NamedVariadicParamStub             func(strs ...string)
	NamedVariadicParamCalled           int32
	SameTypeNamedParamsStub            func(str1 string, str2 string)
	SameTypeNamedParamsCalled          int32
	InternalTypeParamStub              func(internal internal.Internal)
	InternalTypeParamCalled            int32
	ImportedParamStub                  func(tmpl template.Template)
	ImportedParamCalled                int32
	ImportedVariadicParamStub          func(tmpl ...template.Template)
	ImportedVariadicParamCalled        int32
	RenamedImportParamStub             func(tmpl renamed.Template)
	RenamedImportParamCalled           int32
	RenamedImportVariadicParamStub     func(tmpls ...renamed.Template)
	RenamedImportVariadicParamCalled   int32
	DotImportParamStub                 func(file File)
	DotImportParamCalled               int32
	DotImportVariadicParamStub         func(files ...File)
	DotImportVariadicParamCalled       int32
	SelfReferentialParamStub           func(intf Example)
	SelfReferentialParamCalled         int32
	SelfReferentialVariadicParamStub   func(intf ...Example)
	SelfReferentialVariadicParamCalled int32
	StructParamStub                    func(obj struct {
		// contains filtered or unexported fields
	})
	StructParamCalled         int32
	StructVariadicParamStub   func(objs ...struct{ num int })
	StructVariadicParamCalled int32
	EmbeddedStructParamStub   func(obj struct {
		// contains filtered or unexported fields
	})
	EmbeddedStructParamCalled                int32
	EmbeddedStructVariadicParamStub          func(objs ...struct{ int })
	EmbeddedStructVariadicParamCalled        int32
	EmptyInterfaceParamStub                  func(intf interface{})
	EmptyInterfaceParamCalled                int32
	EmptyInterfaceVariadicParamStub          func(intf ...interface{})
	EmptyInterfaceVariadicParamCalled        int32
	InterfaceParamStub                       func(intf interface{ MyFunc(num int) error })
	InterfaceParamCalled                     int32
	InterfaceVariadicParamStub               func(intf ...interface{ MyFunc(num int) error })
	InterfaceVariadicParamCalled             int32
	InterfaceVariadicFuncParamStub           func(intf interface{ MyFunc(nums ...int) error })
	InterfaceVariadicFuncParamCalled         int32
	InterfaceVariadicFuncVariadicParamStub   func(intf ...interface{ MyFunc(nums ...int) error })
	InterfaceVariadicFuncVariadicParamCalled int32
	EmbeddedInterfaceParamStub               func(intf interface{ fmt.Stringer })
	EmbeddedInterfaceParamCalled             int32
	UnnamedReturnStub                        func() error
	UnnamedReturnCalled                      int32
	MultipleUnnamedReturnStub                func() (int, error)
	MultipleUnnamedReturnCalled              int32
	BlankReturnStub                          func() (_ error)
	BlankReturnCalled                        int32
	NamedReturnStub                          func() (err error)
	NamedReturnCalled                        int32
	SameTypeNamedReturnStub                  func() (err1 error, err2 error)
	SameTypeNamedReturnCalled                int32
	RenamedImportReturnStub                  func() (tmpl renamed.Template)
	RenamedImportReturnCalled                int32
	DotImportReturnStub                      func() (file File)
	DotImportReturnCalled                    int32
	SelfReferentialReturnStub                func() (intf Example)
	SelfReferentialReturnCalled              int32
	StructReturnStub                         func() (obj struct {
		// contains filtered or unexported fields
	})
	StructReturnCalled       int32
	EmbeddedStructReturnStub func() (obj struct {
		// contains filtered or unexported fields
	})
	EmbeddedStructReturnCalled        int32
	EmptyInterfaceReturnStub          func() (intf interface{})
	EmptyInterfaceReturnCalled        int32
	InterfaceReturnStub               func() (intf interface{ MyFunc(num int) error })
	InterfaceReturnCalled             int32
	InterfaceVariadicFuncReturnStub   func() (intf interface{ MyFunc(nums ...int) error })
	InterfaceVariadicFuncReturnCalled int32
	EmbeddedInterfaceReturnStub       func() (intf interface{ fmt.Stringer })
	EmbeddedInterfaceReturnCalled     int32
}

ExampleMock is a mock implementation of the Example interface.

func (*ExampleMock) BlankParam

func (m *ExampleMock) BlankParam(param1 string)

BlankParam is a stub for the Example.BlankParam method that records the number of times it has been called.

func (*ExampleMock) BlankReturn

func (m *ExampleMock) BlankReturn() (_ error)

BlankReturn is a stub for the Example.BlankReturn method that records the number of times it has been called.

func (*ExampleMock) BlankVariadicParam

func (m *ExampleMock) BlankVariadicParam(param1 ...string)

BlankVariadicParam is a stub for the Example.BlankVariadicParam method that records the number of times it has been called.

func (*ExampleMock) DotImportParam

func (m *ExampleMock) DotImportParam(file File)

DotImportParam is a stub for the Example.DotImportParam method that records the number of times it has been called.

func (*ExampleMock) DotImportReturn

func (m *ExampleMock) DotImportReturn() (file File)

DotImportReturn is a stub for the Example.DotImportReturn method that records the number of times it has been called.

func (*ExampleMock) DotImportVariadicParam

func (m *ExampleMock) DotImportVariadicParam(files ...File)

DotImportVariadicParam is a stub for the Example.DotImportVariadicParam method that records the number of times it has been called.

func (*ExampleMock) EmbeddedInterfaceParam

func (m *ExampleMock) EmbeddedInterfaceParam(intf interface{ fmt.Stringer })

EmbeddedInterfaceParam is a stub for the Example.EmbeddedInterfaceParam method that records the number of times it has been called.

func (*ExampleMock) EmbeddedInterfaceReturn

func (m *ExampleMock) EmbeddedInterfaceReturn() (intf interface{ fmt.Stringer })

EmbeddedInterfaceReturn is a stub for the Example.EmbeddedInterfaceReturn method that records the number of times it has been called.

func (*ExampleMock) EmbeddedStructParam

func (m *ExampleMock) EmbeddedStructParam(obj struct{ int })

EmbeddedStructParam is a stub for the Example.EmbeddedStructParam method that records the number of times it has been called.

func (*ExampleMock) EmbeddedStructReturn

func (m *ExampleMock) EmbeddedStructReturn() (obj struct{ int })

EmbeddedStructReturn is a stub for the Example.EmbeddedStructReturn method that records the number of times it has been called.

func (*ExampleMock) EmbeddedStructVariadicParam

func (m *ExampleMock) EmbeddedStructVariadicParam(objs ...struct{ int })

EmbeddedStructVariadicParam is a stub for the Example.EmbeddedStructVariadicParam method that records the number of times it has been called.

func (*ExampleMock) EmptyInterfaceParam

func (m *ExampleMock) EmptyInterfaceParam(intf interface{})

EmptyInterfaceParam is a stub for the Example.EmptyInterfaceParam method that records the number of times it has been called.

func (*ExampleMock) EmptyInterfaceReturn

func (m *ExampleMock) EmptyInterfaceReturn() (intf interface{})

EmptyInterfaceReturn is a stub for the Example.EmptyInterfaceReturn method that records the number of times it has been called.

func (*ExampleMock) EmptyInterfaceVariadicParam

func (m *ExampleMock) EmptyInterfaceVariadicParam(intf ...interface{})

EmptyInterfaceVariadicParam is a stub for the Example.EmptyInterfaceVariadicParam method that records the number of times it has been called.

func (*ExampleMock) ImportedParam

func (m *ExampleMock) ImportedParam(tmpl template.Template)

ImportedParam is a stub for the Example.ImportedParam method that records the number of times it has been called.

func (*ExampleMock) ImportedVariadicParam

func (m *ExampleMock) ImportedVariadicParam(tmpl ...template.Template)

ImportedVariadicParam is a stub for the Example.ImportedVariadicParam method that records the number of times it has been called.

func (*ExampleMock) InterfaceParam

func (m *ExampleMock) InterfaceParam(intf interface{ MyFunc(num int) error })

InterfaceParam is a stub for the Example.InterfaceParam method that records the number of times it has been called.

func (*ExampleMock) InterfaceReturn

func (m *ExampleMock) InterfaceReturn() (intf interface{ MyFunc(num int) error })

InterfaceReturn is a stub for the Example.InterfaceReturn method that records the number of times it has been called.

func (*ExampleMock) InterfaceVariadicFuncParam

func (m *ExampleMock) InterfaceVariadicFuncParam(intf interface{ MyFunc(nums ...int) error })

InterfaceVariadicFuncParam is a stub for the Example.InterfaceVariadicFuncParam method that records the number of times it has been called.

func (*ExampleMock) InterfaceVariadicFuncReturn

func (m *ExampleMock) InterfaceVariadicFuncReturn() (intf interface{ MyFunc(nums ...int) error })

InterfaceVariadicFuncReturn is a stub for the Example.InterfaceVariadicFuncReturn method that records the number of times it has been called.

func (*ExampleMock) InterfaceVariadicFuncVariadicParam

func (m *ExampleMock) InterfaceVariadicFuncVariadicParam(intf ...interface{ MyFunc(nums ...int) error })

InterfaceVariadicFuncVariadicParam is a stub for the Example.InterfaceVariadicFuncVariadicParam method that records the number of times it has been called.

func (*ExampleMock) InterfaceVariadicParam

func (m *ExampleMock) InterfaceVariadicParam(intf ...interface{ MyFunc(num int) error })

InterfaceVariadicParam is a stub for the Example.InterfaceVariadicParam method that records the number of times it has been called.

func (*ExampleMock) InternalTypeParam

func (m *ExampleMock) InternalTypeParam(internal internal.Internal)

InternalTypeParam is a stub for the Example.InternalTypeParam method that records the number of times it has been called.

func (*ExampleMock) MultipleUnnamedReturn

func (m *ExampleMock) MultipleUnnamedReturn() (int, error)

MultipleUnnamedReturn is a stub for the Example.MultipleUnnamedReturn method that records the number of times it has been called.

func (*ExampleMock) NamedParam

func (m *ExampleMock) NamedParam(str string)

NamedParam is a stub for the Example.NamedParam method that records the number of times it has been called.

func (*ExampleMock) NamedReturn

func (m *ExampleMock) NamedReturn() (err error)

NamedReturn is a stub for the Example.NamedReturn method that records the number of times it has been called.

func (*ExampleMock) NamedVariadicParam

func (m *ExampleMock) NamedVariadicParam(strs ...string)

NamedVariadicParam is a stub for the Example.NamedVariadicParam method that records the number of times it has been called.

func (*ExampleMock) NoParamsOrReturn

func (m *ExampleMock) NoParamsOrReturn()

NoParamsOrReturn is a stub for the Example.NoParamsOrReturn method that records the number of times it has been called.

func (*ExampleMock) RenamedImportParam

func (m *ExampleMock) RenamedImportParam(tmpl renamed.Template)

RenamedImportParam is a stub for the Example.RenamedImportParam method that records the number of times it has been called.

func (*ExampleMock) RenamedImportReturn

func (m *ExampleMock) RenamedImportReturn() (tmpl renamed.Template)

RenamedImportReturn is a stub for the Example.RenamedImportReturn method that records the number of times it has been called.

func (*ExampleMock) RenamedImportVariadicParam

func (m *ExampleMock) RenamedImportVariadicParam(tmpls ...renamed.Template)

RenamedImportVariadicParam is a stub for the Example.RenamedImportVariadicParam method that records the number of times it has been called.

func (*ExampleMock) SameTypeNamedParams

func (m *ExampleMock) SameTypeNamedParams(str1 string, str2 string)

SameTypeNamedParams is a stub for the Example.SameTypeNamedParams method that records the number of times it has been called.

func (*ExampleMock) SameTypeNamedReturn

func (m *ExampleMock) SameTypeNamedReturn() (err1 error, err2 error)

SameTypeNamedReturn is a stub for the Example.SameTypeNamedReturn method that records the number of times it has been called.

func (*ExampleMock) SelfReferentialParam

func (m *ExampleMock) SelfReferentialParam(intf Example)

SelfReferentialParam is a stub for the Example.SelfReferentialParam method that records the number of times it has been called.

func (*ExampleMock) SelfReferentialReturn

func (m *ExampleMock) SelfReferentialReturn() (intf Example)

SelfReferentialReturn is a stub for the Example.SelfReferentialReturn method that records the number of times it has been called.

func (*ExampleMock) SelfReferentialVariadicParam

func (m *ExampleMock) SelfReferentialVariadicParam(intf ...Example)

SelfReferentialVariadicParam is a stub for the Example.SelfReferentialVariadicParam method that records the number of times it has been called.

func (*ExampleMock) StructParam

func (m *ExampleMock) StructParam(obj struct{ num int })

StructParam is a stub for the Example.StructParam method that records the number of times it has been called.

func (*ExampleMock) StructReturn

func (m *ExampleMock) StructReturn() (obj struct{ num int })

StructReturn is a stub for the Example.StructReturn method that records the number of times it has been called.

func (*ExampleMock) StructVariadicParam

func (m *ExampleMock) StructVariadicParam(objs ...struct{ num int })

StructVariadicParam is a stub for the Example.StructVariadicParam method that records the number of times it has been called.

func (*ExampleMock) UnnamedParam

func (m *ExampleMock) UnnamedParam(param1 string)

UnnamedParam is a stub for the Example.UnnamedParam method that records the number of times it has been called.

func (*ExampleMock) UnnamedReturn

func (m *ExampleMock) UnnamedReturn() error

UnnamedReturn is a stub for the Example.UnnamedReturn method that records the number of times it has been called.

func (*ExampleMock) UnnamedVariadicParam

func (m *ExampleMock) UnnamedVariadicParam(param1 ...string)

UnnamedVariadicParam is a stub for the Example.UnnamedVariadicParam method that records the number of times it has been called.

type Generic

type Generic[T interface{ byte | internal.Internal }, U any] interface {
	GetT() T
	GetU() U
}

Generic is a sample generic interface with a complex type parameter list.

type GenericMock

type GenericMock[T interface{ byte | internal.Internal }, U any] struct {
	T          *testing.T
	GetTStub   func() T
	GetTCalled int32
	GetUStub   func() U
	GetUCalled int32
}

GenericMock is a mock implementation of the Generic interface.

func (*GenericMock[T, U]) GetT

func (m *GenericMock[T, U]) GetT() T

GetT is a stub for the Generic.GetT method that records the number of times it has been called.

func (*GenericMock[T, U]) GetU

func (m *GenericMock[T, U]) GetU() U

GetU is a stub for the Generic.GetU method that records the number of times it has been called.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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