Source File
match.go
Belonging Package
testing
package testing
import (
)
for , := range {
if , := (, "non-empty"); != nil {
fmt.Fprintf(os.Stderr, "testing: invalid regexp for element %d of %s (%q): %s\n", , , , )
os.Exit(1)
}
}
}
return &matcher{
filter: ,
matchFunc: ,
subNames: map[string]int64{},
}
}
func ( *matcher) ( *common, string) ( string, , bool) {
=
.mu.Lock()
defer .mu.Unlock()
if != nil && .level > 0 {
= .unique(.name, rewrite())
}
matchMutex.Lock()
defer matchMutex.Unlock()
:= strings.Split(, "/")
for , := range {
if >= len(.filter) {
break
}
if , := .matchFunc(.filter[], ); ! {
return , false, false
}
}
return , true, len() < len(.filter)
}
func ( string) []string {
:= make([]string, 0, strings.Count(, "/"))
:= 0
:= 0
for := 0; < len(); {
switch [] {
case '[':
++
case ']':
if --; < 0 { // An unmatched ']' is legal.
= 0
}
case '(':
if == 0 {
++
}
case ')':
if == 0 {
--
}
case '\\':
++
case '/':
if == 0 && == 0 {
= append(, [:])
= [+1:]
= 0
continue
}
}
++
}
return append(, )
}
.subNames[] = + 1
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |