Debian Codegraph @

tw/fn_test.go

raw
1 package tw
2
3 import (
4 "reflect"
5 "testing"
6 )
7
8 func TestSplitCase(t *testing.T) {
9 tests := []struct {
10 input string
11 expected []string
12 }{
13 {
14 input: "",
15 expected: []string{},
16 },
17 {
18 input: "snake_Case",
19 expected: []string{"snake", "Case"},
20 },
21 {
22 input: "PascalCase",
23 expected: []string{"Pascal", "Case"},
24 },
25 {
26 input: "camelCase",
27 expected: []string{"camel", "Case"},
28 },
29 {
30 input: "_snake_CasePascalCase_camelCase123",
31 expected: []string{"snake", "Case", "Pascal", "Case", "camel", "Case", "123"},
32 },
33 {
34 input: "ㅤ",
35 expected: []string{"ㅤ"},
36 },
37 {
38 input: " \r\n\t",
39 expected: []string{},
40 },
41 }
42 for _, tt := range tests {
43 t.Run(tt.input, func(t *testing.T) {
44 if output := SplitCamelCase(tt.input); !reflect.DeepEqual(output, tt.expected) {
45 t.Errorf("SplitCamelCase(%q) = %v, want %v", tt.input, output, tt.expected)
46 }
47 })
48 }
49 }