gen_test.go 479 B

12345678910111213141516171819202122232425262728293031323334
  1. package mysql
  2. import (
  3. "testing"
  4. "github.com/google/go-cmp/cmp"
  5. )
  6. func TestArgName(t *testing.T) {
  7. tcase := [...]struct {
  8. input string
  9. output string
  10. }{
  11. {
  12. input: "get_users",
  13. output: "getUsers",
  14. },
  15. {
  16. input: "get_users_by_id",
  17. output: "getUsersByID",
  18. },
  19. {
  20. input: "get_all_",
  21. output: "getAll",
  22. },
  23. }
  24. for _, tc := range tcase {
  25. name := argName(tc.input)
  26. if diff := cmp.Diff(name, tc.output); diff != "" {
  27. t.Errorf(diff)
  28. }
  29. }
  30. }