utils_test.go 771 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package utils
  2. import "testing"
  3. func TestCamel2id(t *testing.T) {
  4. type args struct {
  5. s string
  6. }
  7. tests := []struct {
  8. name string
  9. args args
  10. want string
  11. }{
  12. {"v1", args{s: "getServerName"}, "get server name"},
  13. }
  14. for _, tt := range tests {
  15. t.Run(tt.name, func(t *testing.T) {
  16. if got := Camel2id(tt.args.s); got != tt.want {
  17. t.Errorf("Camel2id() = %v, want %v", got, tt.want)
  18. }
  19. })
  20. }
  21. }
  22. func TestUcFirst(t *testing.T) {
  23. type args struct {
  24. s string
  25. }
  26. tests := []struct {
  27. name string
  28. args args
  29. want string
  30. }{
  31. {"1",args{s:"GetName"},"getName"},
  32. }
  33. for _, tt := range tests {
  34. t.Run(tt.name, func(t *testing.T) {
  35. if got := LowerFirst(tt.args.s); got != tt.want {
  36. t.Errorf("UcFirst() = %v, want %v", got, tt.want)
  37. }
  38. })
  39. }
  40. }