summaryrefslogtreecommitdiff
path: root/src/pkg/sort/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/sort/example_test.go')
-rw-r--r--src/pkg/sort/example_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/sort/example_test.go b/src/pkg/sort/example_test.go
index f57d02546..f7372bec3 100644
--- a/src/pkg/sort/example_test.go
+++ b/src/pkg/sort/example_test.go
@@ -15,3 +15,10 @@ func ExampleInts() {
fmt.Println(s)
// Output: [1 2 3 4 5 6]
}
+
+func ExampleReverse() {
+ s := []int{5, 2, 6, 3, 1, 4} // unsorted
+ sort.Sort(sort.Reverse(sort.IntSlice(s)))
+ fmt.Println(s)
+ // Output: [6 5 4 3 2 1]
+}