This is an automated email from the ASF dual-hosted git repository.
zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new ca23b02 Add an example/test for a utility function (#6045)
ca23b02 is described below
commit ca23b02797030bf2de63a28bb624b218ef4d5194
Author: ocket8888 <[email protected]>
AuthorDate: Wed Aug 11 15:25:56 2021 -0600
Add an example/test for a utility function (#6045)
---
lib/go-util/join_test.go | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/lib/go-util/join_test.go b/lib/go-util/join_test.go
index 0d0d961..419d50a 100644
--- a/lib/go-util/join_test.go
+++ b/lib/go-util/join_test.go
@@ -19,8 +19,10 @@ package util
* under the License.
*/
-import "errors"
-import "fmt"
+import (
+ "errors"
+ "fmt"
+)
func ExampleJoinErrsSep() {
errs := []error{
@@ -33,3 +35,16 @@ func ExampleJoinErrsSep() {
// Output: test
// quest
}
+
+func ExampleCamelToSnakeCase() {
+ camel := "camelCase"
+ fmt.Println(CamelToSnakeCase(camel))
+ camel = "PascalCase"
+ fmt.Println(CamelToSnakeCase(camel))
+ camel = "IPIsAnInitialismForInternetProtocol"
+ fmt.Println(CamelToSnakeCase(camel))
+
+ // Output: camel_case
+ // pascal_case
+ // ipis_an_initialism_for_internet_protocol
+}