MCPcopy
hub / github.com/golang/go / matchTest

Function matchTest

src/pkg/regexp/all_test.go:75–89  ·  view source on GitHub ↗
(t *testing.T, test *FindTest)

Source from the content-addressed store, hash-verified

73}
74
75func matchTest(t *testing.T, test *FindTest) {
76 re := compileTest(t, test.pat, nil)
77 if re == nil {
78 return
79 }
80 m := re.MatchString(test.text)
81 if m != (len(test.matches) > 0) {
82 t.Errorf("MatchString failure on %s: %t should be %t", test, m, len(test.matches) > 0)
83 }
84 // now try bytes
85 m = re.Match([]byte(test.text))
86 if m != (len(test.matches) > 0) {
87 t.Errorf("Match failure on %s: %t should be %t", test, m, len(test.matches) > 0)
88 }
89}
90
91func TestMatch(t *testing.T) {
92 for _, test := range findTests {

Callers 1

TestMatchFunction · 0.85

Calls 4

compileTestFunction · 0.85
MatchStringMethod · 0.80
MatchMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected