1
0
mirror of https://github.com/golang/go synced 2024-10-04 16:31:22 -06:00
go/src/pkg/testing
Andrew Gerrand 11e113db57 godoc: make example code more readable with new comment convention
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention

This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).

An idiomatic example looks like this:

// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
        // example body that does bar and quux

        // Output:
        // example output
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
..
iotest testing/iotest: adjust adverbial imprecision in package comment 2012-02-10 14:37:20 +11:00
quick testing/quick: documentation tweaks 2012-02-10 14:37:50 +11:00
benchmark.go testing: fix references to "gotest" 2012-02-10 13:49:50 +11:00
example.go testing: do not recover example's panic 2012-01-19 10:19:33 -08:00
testing.go godoc: make example code more readable with new comment convention 2012-02-16 11:50:28 +11:00