hello/reverse: add example example test This will be linked from an updated go.dev/blog/examples. For #61722. Change-Id: I329141141e0590a6d7ee0b6b504c8f7bdc9c2d5f Reviewed-on: https://go-review.googlesource.com/c/example/+/515237 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/hello/reverse/example_test.go b/hello/reverse/example_test.go new file mode 100644 index 0000000..a0df581 --- /dev/null +++ b/hello/reverse/example_test.go
@@ -0,0 +1,16 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package reverse_test + +import ( + "fmt" + + "golang.org/x/example/hello/reverse" +) + +func ExampleString() { + fmt.Println(reverse.String("hello")) + // Output: olleh +}