convertstringtocamelcase_test.go 527 B

1234567891011121314151617181920212223242526
  1. package kata
  2. import (
  3. "testing"
  4. )
  5. type check struct {
  6. name string
  7. src string
  8. expected string
  9. }
  10. func TestToCamelCase(t *testing.T) {
  11. checks := []check{
  12. {"dashes", "the-stealth-warrior", "theStealthWarrior"},
  13. {"snake", "the_stealth_warrior", "theStealthWarrior"},
  14. {"Snake", "The_stealth_warrior", "TheStealthWarrior"},
  15. }
  16. for _, check := range checks {
  17. actual := ToCamelCase(check.src);
  18. if actual != check.expected {
  19. t.Errorf("%s: expected %v got %v", check.name, check.expected, actual)
  20. }
  21. }
  22. }