gitee.com/gricks/utils@v1.0.8/casee_test.go (about) 1 package utils 2 3 import ( 4 "testing" 5 6 . "github.com/smartystreets/goconvey/convey" 7 ) 8 9 func Test_CamelcaseSplit(t *testing.T) { 10 Convey("CamelcaseSplit", t, func() { 11 cases := []struct { 12 str string 13 expect []string 14 }{ 15 {"", []string{}}, 16 {"lowercase", []string{"lowercase"}}, 17 {"Class", []string{"Class"}}, 18 {"MyClass", []string{"My", "Class"}}, 19 {"MyC", []string{"My", "C"}}, 20 {"HTML", []string{"HTML"}}, 21 {"PDFLoader", []string{"PDF", "Loader"}}, 22 {"AString", []string{"A", "String"}}, 23 {"SimpleXMLParser", []string{"Simple", "XML", "Parser"}}, 24 {"vimRPCPlugin", []string{"vim", "RPC", "Plugin"}}, 25 {"GL11Version", []string{"GL", "11", "Version"}}, 26 {"99Bottles", []string{"99", "Bottles"}}, 27 {"May5", []string{"May", "5"}}, 28 {"BFG9000", []string{"BFG", "9000"}}, 29 {"BöseÜberraschung", []string{"Böse", "Überraschung"}}, 30 {"Two spaces", []string{"Two", " ", "spaces"}}, 31 {"BadUTF8\xe2\xe2\xa1", []string{"BadUTF8\xe2\xe2\xa1"}}, 32 } 33 for _, c := range cases { 34 So(CamelcaseSplit(c.str), ShouldResemble, c.expect) 35 } 36 }) 37 }