You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If -run is provided but there is no test matching the pattern, go test currently considers the test run PASS and exits with 0.
$ go test -run=Test_sum/1_+_1
testing: warning: no tests to run
ok example/test 0.133s
Even though there is a warning like "testing: warning: no tests to run", this is easy to miss or dropped when the test binary runs by other runners (ide plugins, dlv, ..). I think when users set -run and if there is no matching test, that's likely not what users wanted, and treating it like misuse of command is more appropriate.
The text was updated successfully, but these errors were encountered:
Slightly related, but in the opposite direction: go test and go vet currently print a warning and also exit with a fatal error when an import path pattern matches 0 packages (#31271, #52287), which can create overhead for a CI system wishing to permit modules that are empty or have packages for a subset of Go's ports, since they have no choice but need to convert such false-positive failures to successes on their own.
changed the title
cmd/go: change go test to FAIL if -run is specified but no tests match
proposal: cmd/go: change go test to FAIL if -run is specified but no tests match
Dec 1, 2023