summaryrefslogtreecommitdiff
path: root/libgo/go/testing/example.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/testing/example.go')
-rw-r--r--libgo/go/testing/example.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go
index fd8343f3bfc..e5bce7af4e7 100644
--- a/libgo/go/testing/example.go
+++ b/libgo/go/testing/example.go
@@ -21,7 +21,14 @@ type InternalExample struct {
Unordered bool
}
+// An internal function but exported because it is cross-package; part of the implementation
+// of the "go test" command.
func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) {
+ _, ok = runExamples(matchString, examples)
+ return ok
+}
+
+func runExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ran, ok bool) {
ok = true
var eg InternalExample
@@ -35,12 +42,13 @@ func RunExamples(matchString func(pat, str string) (bool, error), examples []Int
if !matched {
continue
}
+ ran = true
if !runExample(eg) {
ok = false
}
}
- return
+ return ran, ok
}
func sortLines(output string) string {