From: Alexander Döring Date: Mon, 10 Apr 2017 18:57:45 +0000 (+0200) Subject: testing: document example with unordered output X-Git-Tag: go1.9beta1~760 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=44bd39c3a4c4635872a35154927b073f12a2755d;p=gostls13.git 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/37440 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/testing/testing.go b/src/testing/testing.go index 130977f106..e5a3c3b93c 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -83,16 +83,30 @@ // ignores leading and trailing space.) These are examples of an example: // // func ExampleHello() { -// fmt.Println("hello") -// // Output: hello +// fmt.Println("hello") +// // Output: hello // } // // func ExampleSalutations() { -// fmt.Println("hello, and") -// fmt.Println("goodbye") -// // Output: -// // hello, and -// // goodbye +// fmt.Println("hello, and") +// fmt.Println("goodbye") +// // Output: +// // hello, and +// // 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.