aboutsummaryrefslogtreecommitdiff
path: root/src/testing/example.go
diff options
context:
space:
mode:
authorMauri de Souza Meneguzzo <mauri870@gmail.com>2023-07-21 18:49:09 +0000
committerGopher Robot <gobot@golang.org>2023-07-21 21:37:46 +0000
commit2eca0b1e1663d826893b6b1fd8bd89da98e65d1e (patch)
tree1e8b0e7329ad3977f0b5c4bc21112b87082dcdd2 /src/testing/example.go
parente713d6f939c90eb599c1469d08bb5edd7de8a281 (diff)
downloadgo-2eca0b1e1663d826893b6b1fd8bd89da98e65d1e.tar.xz
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: e8c3c3460af906f4c7be7f7a8b4a4c60b71fcec1 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>
Diffstat (limited to 'src/testing/example.go')
-rw-r--r--src/testing/example.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/testing/example.go b/src/testing/example.go
index 42ee555cb2..07aa5cb66c 100644
--- a/src/testing/example.go
+++ b/src/testing/example.go
@@ -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
}