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

Failed to mock the methods of self defined class #40

Open
ilovewchao opened this issue Jul 15, 2014 · 0 comments
Open

Failed to mock the methods of self defined class #40

ilovewchao opened this issue Jul 15, 2014 · 0 comments

Comments

@ilovewchao
Copy link

@qur I don't no how to describe the problem clearly, so I have wrote some cases to show it. You can see them here: https://github.com/ilovewchao/withmock-test.git

In brief words, when I define a 'type struct Baz{}' without any filed, 'withmock go test' will PASS; but when Baz is defined as 'type struct Baz{name string}' which contains a filed, the test will fail:

--- FAIL: TestTryMe (0.00 seconds)
controller.go:113: no matching expected call: *baz.Baz.DoSomething([])
controller.go:158: missing call(s) to *baz.Baz.DoSomething()
controller.go:158: missing call(s) to *fmt._packageMock.Println(is anything)
controller.go:165: aborting test due to missing call(s)
FAIL
exit status 1
FAIL github.com/ilovewchao/withmock-test/foo 0.003s

Hope you can help me with the issue. Thank you!

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

1 participant