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

testing: skip flag not applied to examples #61482

Closed
pascaldekloe opened this issue Jul 20, 2023 · 7 comments
Closed

testing: skip flag not applied to examples #61482

pascaldekloe opened this issue Jul 20, 2023 · 7 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@pascaldekloe
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go version devel go1.21-9cf97cbbdd Fri Jul 14 16:37:04 2023 +0200 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What did you do?

Run go test -v strings -skip Trim.

What did you expect to see?

Regular expression "Trim" should skip ExampleTrim.

-skip regexp
    Run only those tests, examples, fuzz tests, and benchmarks that
    do not match the regular expression.

What did you see instead?

Go runs ExampleTrim anyway.

=== RUN   ExampleTrim
--- PASS: ExampleTrim (0.00s)

It does skip TestTrim though.

@heschi
Copy link
Contributor

heschi commented Jul 20, 2023

cc @bcmills

@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 20, 2023
@heschi heschi changed the title cmd/go: skip flag not applied to examples testing: skip flag not applied to examples Jul 20, 2023
@heschi heschi added this to the Go1.22 milestone Jul 20, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 20, 2023

@pascaldekloe, want to send a fix?

@pascaldekloe
Copy link
Contributor Author

Maybe @bcmills. There's too many bugs open in the Go command and they start to bother me now. Will let you know here if I take it.

@mauri870
Copy link
Member

@pascaldekloe I can try working on this if you don't mind ;)

@bcmills
Copy link
Contributor

bcmills commented Jul 20, 2023

There's too many bugs open in the Go command and they start to bother me now.

You're not wrong about the Go command (it bothers me too!), but technically this bug is in the testing package. 🙃

mauri870 added a commit to mauri870/go that referenced this issue Jul 21, 2023
The go test flags -skip and -run had no effect in example tests.

Fixes golang#61482
mauri870 added a commit to mauri870/go that referenced this issue Jul 21, 2023
The go test flag -skip had no effect in example tests.

Fixes golang#61482
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/511837 mentions this issue: testing: enforce -skip in example tests

mauri870 added a commit to mauri870/go that referenced this issue Jul 21, 2023
The go test flag -skip had no effect in example tests.

Fixes golang#61482
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/519595 mentions this issue: cmd/go/testdata/script: ensure go test -skip skips ExampleTest1

gopherbot pushed a commit that referenced this issue Aug 15, 2023
CL 511837 added a check for go test -skip Example but it currently
doesn't verify that the example doesn't show up in the command output.
Add such a check.

For #61482

Change-Id: I3a8f82fc137739bf291f39bf7719ff92cfc74f9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/519595
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
@golang golang locked and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants