feat: add stringx.ToCamelCase (#2622)

This commit is contained in:
Kevin Wan
2022-11-20 17:41:39 +08:00
committed by GitHub
parent 20e659749a
commit 95a5f64493
2 changed files with 65 additions and 0 deletions

View File

@@ -396,6 +396,61 @@ func TestTakeWithPriority(t *testing.T) {
}
}
func TestToCamelCase(t *testing.T) {
tests := []struct {
input string
expect string
}{
{
input: "",
expect: "",
},
{
input: "A",
expect: "a",
},
{
input: "a",
expect: "a",
},
{
input: "hello_world",
expect: "hello_world",
},
{
input: "Hello_world",
expect: "hello_world",
},
{
input: "hello_World",
expect: "hello_World",
},
{
input: "helloWorld",
expect: "helloWorld",
},
{
input: "HelloWorld",
expect: "helloWorld",
},
{
input: "hello World",
expect: "hello World",
},
{
input: "Hello World",
expect: "hello World",
},
}
for _, test := range tests {
test := test
t.Run(test.input, func(t *testing.T) {
assert.Equal(t, test.expect, ToCamelCase(test.input))
})
}
}
func TestUnion(t *testing.T) {
first := []string{
"one",