Skip to content

Conversation

@tomMoulard
Copy link
Contributor

This PR adds support for generic interfaces to be mocked.

Here is the basic example:

// interfaces.go
type Banana[T, U any] interface {
	Tree(T)
	Flower() U
	Pudding()
}

// mock_test.go

// mocktail:Banana

// interfaces_test.go
var b Banana[string, int] = newBananaMock[string, int](t).
	OnTree("a").Once().
	OnFlower().TypedReturns(1).Once().
	OnPudding().Once().
	Parent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants