(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestNameFormat(t *testing.T) { |
| 8 | names := [][]string{ |
| 9 | {"id_", "_id", "id", "iD", "ID", "Id", "order_id", "orderId", "orderID", "OrderID"}, |
| 10 | {"ip_", "_ip", "ip", "iP", "IP", "Ip", "host_ip", "hostIp", "hostIP", "HostIP"}, |
| 11 | {"url_", "_url", "url", "uRL", "URL", "Url", "blog_url", "blogUrl", "blogURL", "BlogURL"}, |
| 12 | {"_user_name", "user_name", "userName", "UserName"}, |
| 13 | {"_zh_中文", "zh_中文", "中文zh"}, |
| 14 | } |
| 15 | |
| 16 | for _, ns := range names { |
| 17 | var convertNames []string |
| 18 | var convertNames2 []string |
| 19 | var convertNames3 []string |
| 20 | for _, name := range ns { |
| 21 | convertNames = append(convertNames, toCamel(name)) |
| 22 | convertNames2 = append(convertNames2, customToCamel(name)) |
| 23 | convertNames3 = append(convertNames3, customToSnake(name)) |
| 24 | } |
| 25 | t.Log("source: ", ns) |
| 26 | t.Log("toCamel: ", convertNames) |
| 27 | t.Log("customToCamel:", convertNames2) |
| 28 | t.Log("customToSnake:", convertNames3) |
| 29 | println() |
| 30 | } |
| 31 | } |
nothing calls this directly
no test coverage detected