github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/protobuf/protoc-gen-go-grain/generate_test.go (about) 1 package main 2 3 import "testing" 4 5 func Test_toCamel(t *testing.T) { 6 type args struct { 7 s string 8 } 9 tests := []struct { 10 name string 11 args args 12 want string 13 }{ 14 { 15 name: "snake1", 16 args: args{"SYSTEM_ERROR"}, 17 want: "SystemError", 18 }, 19 { 20 name: "snake2", 21 args: args{"System_Error"}, 22 want: "SystemError", 23 }, 24 { 25 name: "snake3", 26 args: args{"system_error"}, 27 want: "SystemError", 28 }, 29 { 30 name: "snake4", 31 args: args{"System_error"}, 32 want: "SystemError", 33 }, 34 { 35 name: "upper1", 36 args: args{"UNKNOWN"}, 37 want: "Unknown", 38 }, 39 { 40 name: "camel1", 41 args: args{"SystemError"}, 42 want: "SystemError", 43 }, 44 { 45 name: "camel2", 46 args: args{"systemError"}, 47 want: "SystemError", 48 }, 49 { 50 name: "lower1", 51 args: args{"system"}, 52 want: "System", 53 }, 54 } 55 for _, tt := range tests { 56 t.Run(tt.name, func(t *testing.T) { 57 if got := toCamel(tt.args.s); got != tt.want { 58 t.Errorf("toCamel() = %v, want %v", got, tt.want) 59 } 60 }) 61 } 62 }