strcase/camel_test.go
2017-06-15 12:32:52 +10:00

27 lines
564 B
Go

package strcase
import (
"testing"
)
func TestToCamel(t *testing.T) {
cases := [][]string{
[]string{ "test_case", "TestCase" },
[]string{ "test", "Test" },
[]string{ "TestCase", "TestCase" },
[]string{ " test case ", "TestCase" },
[]string{ "", "" },
[]string{ "many_many_words", "ManyManyWords" },
[]string{ "AnyKind of_string", "AnyKindOfString" },
[]string{ "odd-fix", "OddFix" },
}
for _, i := range cases {
in := i[0]
out := i[1]
result := ToCamel(in)
if result != out {
t.Error("'" + result + "' != '" + out + "'")
}
}
}