Commit 44bd39c3 authored by Alexander Döring's avatar Alexander Döring Committed by Brad Fitzpatrick

testing: document example with unordered output

Copy the documentation and example from cmd/go.

Fixes #18840.

Change-Id: Id8022762b48576fb4031de05287d07a6ed23f480
Reviewed-on: https://go-review.googlesource.com/37440Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 98a9aeb0
...@@ -83,16 +83,30 @@ ...@@ -83,16 +83,30 @@
// ignores leading and trailing space.) These are examples of an example: // ignores leading and trailing space.) These are examples of an example:
// //
// func ExampleHello() { // func ExampleHello() {
// fmt.Println("hello") // fmt.Println("hello")
// // Output: hello // // Output: hello
// } // }
// //
// func ExampleSalutations() { // func ExampleSalutations() {
// fmt.Println("hello, and") // fmt.Println("hello, and")
// fmt.Println("goodbye") // fmt.Println("goodbye")
// // Output: // // Output:
// // hello, and // // hello, and
// // goodbye // // goodbye
// }
//
// The comment prefix "Unordered output:" is like "Output:", but matches any
// line order:
//
// func ExamplePerm() {
// for _, value := range Perm(4) {
// fmt.Println(value)
// }
// // Unordered output: 4
// // 2
// // 1
// // 3
// // 0
// } // }
// //
// Example functions without output comments are compiled but not executed. // Example functions without output comments are compiled but not executed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment