maxbrunsfeld / counterfeiter

A tool for generating self-contained, type-safe test doubles in go
MIT License
931 stars 90 forks source link

Support for callback func stub? #242

Open wally-tg opened 1 year ago

wally-tg commented 1 year ago
//counterfeiter:generate -o ./customCalcuator/specialFake.go . Calculate
type calculate func(context.Context) (int, error)

Does counterfeiter support callback function?

hoegaarden commented 11 months ago

Does counterfeiter support callback function?

Yes.

package main

import "context"

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate

//counterfeiter:generate -o ./customCalcuator/specialFake.go . calculate
type calculate func(ctx context.Context) (int, error)

func main() {}