mirror of
https://github.com/golang/go.git
synced 2025-10-23 21:13:20 +00:00
testing: enforce -skip in example tests
The go test flag -skip had no effect in example tests.
Fixes #61482
Change-Id: I28dfddb88fef3fead2a3c74f9cb63a674a768231
GitHub-Last-Rev: e8c3c3460a
GitHub-Pull-Request: golang/go#61491
Reviewed-on: https://go-review.googlesource.com/c/go/+/511837
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
e713d6f939
commit
2eca0b1e16
2 changed files with 13 additions and 7 deletions
|
|
@ -6,7 +6,6 @@ package testing
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -29,14 +28,11 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
|
|||
func runExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ran, ok bool) {
|
||||
ok = true
|
||||
|
||||
var eg InternalExample
|
||||
m := newMatcher(matchString, *match, "-test.run", *skip)
|
||||
|
||||
var eg InternalExample
|
||||
for _, eg = range examples {
|
||||
matched, err := matchString(*match, eg.Name)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.run: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
_, matched, _ := m.fullName(nil, eg.Name)
|
||||
if !matched {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue