-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cover: doesn't respect examples #8466
Labels
Milestone
Comments
I am unable to reproduce this. Coverage works fine with examples. Are you including an "Output:" comment in your example function? If not, the example won't be executed as a test. Use "go test -v" to make sure your examples are being executed. Here's my successful test run: ~/src/covertest $ cat foo.go package foo import "fmt" func Foo() { fmt.Println("yay") } ~/src/covertest $ cat foo_test.go package foo func ExampleFoo() { Foo() // Output: yay } ~/src/covertest $ go test -v -cover === RUN: ExampleFoo --- PASS: ExampleFoo (0.00s) PASS coverage: 100.0% of statements ok covertest 0.010s Owner changed to @adg. Status changed to WaitingForReply. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: