Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplyFuncVar和ApplyFunc有什么区别? #135

Open
kaifeng666 opened this issue Jul 5, 2023 · 1 comment
Open

ApplyFuncVar和ApplyFunc有什么区别? #135

kaifeng666 opened this issue Jul 5, 2023 · 1 comment

Comments

@kaifeng666
Copy link

Convey("for succ", func() {
str := "hello"
patches := ApplyFuncVar(&fake.Marshal, func (_ interface{}) ([]byte, error) {
return []byte(str), nil
})
defer patches.Reset()
bytes, err := fake.Marshal(nil)
So(err, ShouldEqual, nil)
So(string(bytes), ShouldEqual, str)
})

ApplyFuncVar替换为ApplyFunc不也是同样的效果?

@xhd2015
Copy link

xhd2015 commented Mar 23, 2024

Seems confusing, why not try xgo instead?
https://github.com/xhd2015/xgo

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

No branches or pull requests

2 participants