github.com/mloves0824/enron/cmd/enron@v0.0.0-20230830012320-113bbf6be3c8/internal/proto/add/add_test.go (about) 1 package add 2 3 import "testing" 4 5 func TestUnderscoreToUpperCamelCase(t *testing.T) { 6 tests := []struct { 7 name string 8 want string 9 }{ 10 { 11 name: "hello_world", 12 want: "HelloWorld", 13 }, 14 { 15 name: "v2_kratos_dev", 16 want: "V2KratosDev", 17 }, 18 { 19 name: "www_Google_com", 20 want: "WwwGoogleCom", 21 }, 22 { 23 name: "wwwBaidu_com", 24 want: "WwwBaiduCom", 25 }, 26 { 27 name: "HelloWorld", 28 want: "HelloWorld", 29 }, 30 } 31 for _, tt := range tests { 32 t.Run(tt.name, func(t *testing.T) { 33 if got := toUpperCamelCase(tt.name); got != tt.want { 34 t.Errorf("toUpperCamelCase() = %v, want %v", got, tt.want) 35 } 36 }) 37 } 38 }