You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1010 B
63 lines
1010 B
3 years ago
|
package main
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func Test_case2Camel(t *testing.T) {
|
||
|
type args struct {
|
||
|
name string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want string
|
||
|
}{
|
||
|
{
|
||
|
name: "snake1",
|
||
|
args: args{"SYSTEM_ERROR"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "snake2",
|
||
|
args: args{"System_Error"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "snake3",
|
||
|
args: args{"system_error"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "snake4",
|
||
|
args: args{"System_error"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "upper1",
|
||
|
args: args{"UNKNOWN"},
|
||
|
want: "Unknown",
|
||
|
},
|
||
|
{
|
||
|
name: "camel1",
|
||
|
args: args{"SystemError"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "camel2",
|
||
|
args: args{"systemError"},
|
||
|
want: "SystemError",
|
||
|
},
|
||
|
{
|
||
|
name: "lower1",
|
||
|
args: args{"system"},
|
||
|
want: "System",
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := case2Camel(tt.args.name); got != tt.want {
|
||
|
t.Errorf("case2Camel() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|