diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2013-05-14 18:39:35 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-05-14 18:39:35 +0200 |
commit | efcc50dfdc94c82ee0292bf71992ecb7c0123061 (patch) | |
tree | 17dca99d1dc7fc4e9fe49c2cf6a99d337d4c039f /src/pkg/testing/testing.go | |
parent | 04b08da9af0c450d645ab7389d1467308cfc2db8 (diff) | |
download | golang-efcc50dfdc94c82ee0292bf71992ecb7c0123061.tar.gz |
Imported Upstream version 1.1upstream/1.1
Diffstat (limited to 'src/pkg/testing/testing.go')
-rw-r--r-- | src/pkg/testing/testing.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pkg/testing/testing.go b/src/pkg/testing/testing.go index 86cd46c29..312d28732 100644 --- a/src/pkg/testing/testing.go +++ b/src/pkg/testing/testing.go @@ -18,6 +18,8 @@ // ... // } // +// Benchmarks +// // Functions of the form // func BenchmarkXxx(*testing.B) // are considered benchmarks, and are executed by the "go test" command when @@ -49,6 +51,8 @@ // } // } // +// Examples +// // The package also runs and verifies example code. Example functions may // include a concluding line comment that begins with "Output:" and is compared with // the standard output of the function when the tests are run. (The comparison @@ -246,11 +250,13 @@ func (c *common) log(s string) { } // Log formats its arguments using default formatting, analogous to Println, -// and records the text in the error log. +// and records the text in the error log. The text will be printed only if +// the test fails or the -test.v flag is set. func (c *common) Log(args ...interface{}) { c.log(fmt.Sprintln(args...)) } // Logf formats its arguments according to the format, analogous to Printf, -// and records the text in the error log. +// and records the text in the error log. The text will be printed only if +// the test fails or the -test.v flag is set. func (c *common) Logf(format string, args ...interface{}) { c.log(fmt.Sprintf(format, args...)) } // Error is equivalent to Log followed by Fail. @@ -337,6 +343,7 @@ func tRunner(t *T, test *InternalTest) { t.duration = time.Now().Sub(t.start) // If the test panicked, print any test output before dying. if err := recover(); err != nil { + t.Fail() t.report() panic(err) } |