replace strings.Title to cases.Title (#2650)

This commit is contained in:
EinfachePhy
2022-12-02 00:15:51 +08:00
committed by GitHub
parent 90828a0d4a
commit 10fd9131a1
3 changed files with 30 additions and 2 deletions

View File

@@ -40,3 +40,27 @@ func TestString_Camel2Snake(t *testing.T) {
ret2 := From("测试Test_Data_test_data").ToSnake()
assert.Equal(t, "测试_test__data_test_data", ret2)
}
func TestTitle(t *testing.T) {
cases := []struct {
src string
exec string
}{
{
src: "hello world!",
exec: "Hello World!",
},
{
src: "go zero",
exec: "Go Zero",
},
{
src: "测试this is data",
exec: "测试This Is Data",
},
}
for _, c := range cases {
ret := From(c.src).Title()
assert.Equal(t, c.exec, ret)
}
}