1234567891011121314151617181920212223242526 |
- package kata
- import (
- "testing"
- )
- type check struct {
- name string
- src string
- expected string
- }
- func TestToCamelCase(t *testing.T) {
- checks := []check{
- {"dashes", "the-stealth-warrior", "theStealthWarrior"},
- {"snake", "the_stealth_warrior", "theStealthWarrior"},
- {"Snake", "The_stealth_warrior", "TheStealthWarrior"},
- }
- for _, check := range checks {
- actual := ToCamelCase(check.src);
- if actual != check.expected {
- t.Errorf("%s: expected %v got %v", check.name, check.expected, actual)
- }
- }
- }
|