12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package utils
- import "testing"
- func TestCamel2id(t *testing.T) {
- type args struct {
- s string
- }
- tests := []struct {
- name string
- args args
- want string
- }{
- {"v1", args{s: "getServerName"}, "get server name"},
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if got := Camel2id(tt.args.s); got != tt.want {
- t.Errorf("Camel2id() = %v, want %v", got, tt.want)
- }
- })
- }
- }
- func TestUcFirst(t *testing.T) {
- type args struct {
- s string
- }
- tests := []struct {
- name string
- args args
- want string
- }{
- {"1",args{s:"GetName"},"getName"},
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if got := LowerFirst(tt.args.s); got != tt.want {
- t.Errorf("UcFirst() = %v, want %v", got, tt.want)
- }
- })
- }
- }
|