|
|
|
@ -2,7 +2,7 @@ package server |
|
|
|
|
|
|
|
|
|
import "testing" |
|
|
|
|
|
|
|
|
|
func Test_ucFirst(t *testing.T) { |
|
|
|
|
func Test_serviceName(t *testing.T) { |
|
|
|
|
type args struct { |
|
|
|
|
str string |
|
|
|
|
} |
|
|
|
@ -12,40 +12,50 @@ func Test_ucFirst(t *testing.T) { |
|
|
|
|
want string |
|
|
|
|
}{ |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on lowercase words", |
|
|
|
|
name: "serviceName on lowercase words", |
|
|
|
|
args: args{str: "helloworld"}, |
|
|
|
|
want: "Helloworld", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on uppercase words", |
|
|
|
|
name: "serviceName on uppercase words", |
|
|
|
|
args: args{str: "HELLOWORLD"}, |
|
|
|
|
want: "HELLOWORLD", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on lowercase words with spaces", |
|
|
|
|
name: "serviceName on lowercase words with spaces", |
|
|
|
|
args: args{str: "hello world"}, |
|
|
|
|
want: "Hello world", |
|
|
|
|
want: "HelloWorld", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on uppercase words with spaces", |
|
|
|
|
name: "serviceName on uppercase words with spaces", |
|
|
|
|
args: args{str: "HELLO WORLD"}, |
|
|
|
|
want: "HELLO WORLD", |
|
|
|
|
want: "HELLOWORLD", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on Lower Camel Case words", |
|
|
|
|
name: "serviceName on Lower Camel Case words", |
|
|
|
|
args: args{str: "helloWorld"}, |
|
|
|
|
want: "HelloWorld", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "ucFirst on Upper Camel Case words", |
|
|
|
|
name: "serviceName on Lower Camel Case words", |
|
|
|
|
args: args{str: "helloWorld"}, |
|
|
|
|
want: "HelloWorld", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "serviceName on Upper Camel Case words", |
|
|
|
|
args: args{str: "HelloWorld"}, |
|
|
|
|
want: "HelloWorld", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: "serviceName on Upper Camel Case words", |
|
|
|
|
args: args{str: "hello_world"}, |
|
|
|
|
want: "HelloWorld", |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
for _, tt := range tests { |
|
|
|
|
t.Run(tt.name, func(t *testing.T) { |
|
|
|
|
if got := ucFirst(tt.args.str); got != tt.want { |
|
|
|
|
t.Errorf("ucFirst() = %v, want %v", got, tt.want) |
|
|
|
|
if got := serviceName(tt.args.str); got != tt.want { |
|
|
|
|
t.Errorf("serviceName() = %v, want %v", got, tt.want) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|