-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamel_test.go
44 lines (41 loc) · 976 Bytes
/
camel_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package stringutils
import (
"testing"
)
func TestPascalCase(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"},
[]string{"numbers2And55with000", "Numbers2And55With000"},
}
for _, i := range cases {
in := i[0]
out := i[1]
result := PascalCase(in)
if result != out {
t.Error("'" + result + "' != '" + out + "'")
}
}
}
func TestCameCase(t *testing.T) {
cases := [][]string{
[]string{"foo-bar", "fooBar"},
[]string{"foo_bar", "fooBar"},
[]string{"foo bar", "fooBar"},
[]string{"foo_bar_baz", "fooBarBaz"},
}
for _, i := range cases {
in := i[0]
out := i[1]
result := CamelCase(in)
if result != out {
t.Error("'" + result + "' != '" + out + "'")
}
}
}