Source File
example.go
Belonging Package
testing
func ( func(, string) (bool, error), []InternalExample) ( bool) {
_, = runExamples(, )
return
}
func ( func(, string) (bool, error), []InternalExample) (, bool) {
= true
var InternalExample
for _, = range {
, := (*match, .Name)
if != nil {
fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.run: %s\n", )
os.Exit(1)
}
if ! {
continue
}
= true
if !runExample() {
= false
}
}
return ,
}
func ( string) string {
:= strings.Split(, "\n")
sort.Strings()
return strings.Join(, "\n")
}
func ( *InternalExample) ( string, time.Duration, bool, interface{}) ( bool) {
= true
:= fmtDuration()
var string
:= strings.TrimSpace()
:= strings.TrimSpace(.Output)
if .Unordered {
if sortLines() != sortLines() && == nil {
= fmt.Sprintf("got:\n%s\nwant (unordered):\n%s\n", , .Output)
}
} else {
if != && == nil {
= fmt.Sprintf("got:\n%s\nwant:\n%s\n", , )
}
}
if != "" || ! || != nil {
fmt.Printf("--- FAIL: %s (%s)\n%s", .Name, , )
= false
} else if *chatty {
fmt.Printf("--- PASS: %s (%s)\n", .Name, )
}
panic()
}
if ! && == nil {
panic(errNilPanicOrGoexit)
}
return
![]() |
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. |