-
Notifications
You must be signed in to change notification settings - Fork 1
/
naming_conventions_test.go
87 lines (79 loc) · 2.11 KB
/
naming_conventions_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package copre
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSplitPathIntoWords(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "Document,PDF,Loader",
"FooBar,FizzBuzz": "Foo,Bar,Fizz,Buzz",
}
for inputStr, expectedStr := range tests {
input := strings.Split(inputStr, ",")
expected := strings.Split(expectedStr, ",")
result := SplitPathIntoWords(input)
assert.Equal(expected, result)
}
}
func TestUpperSnakeCase(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "DOCUMENT_PDF_LOADER",
"FooBar,FizzBuzz": "FOO_BAR_FIZZ_BUZZ",
}
for inputStr, expected := range tests {
input := strings.Split(inputStr, ",")
result := UpperSnakeCase(input)
assert.Equal(expected, result)
}
}
func TestLowerSnakeCase(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "document_pdf_loader",
"FooBar,FizzBuzz": "foo_bar_fizz_buzz",
}
for inputStr, expected := range tests {
input := strings.Split(inputStr, ",")
result := LowerSnakeCase(input)
assert.Equal(expected, result)
}
}
func TestKebabCase(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "document-pdf-loader",
"FooBar,FizzBuzz": "foo-bar-fizz-buzz",
}
for inputStr, expected := range tests {
input := strings.Split(inputStr, ",")
result := KebabCase(input)
assert.Equal(expected, result)
}
}
func TestCamelCase(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "documentPDFLoader",
"FooBar,FizzBuzz": "fooBarFizzBuzz",
}
for inputStr, expected := range tests {
input := strings.Split(inputStr, ",")
result := CamelCase(input)
assert.Equal(expected, result)
}
}
func TestPascalCase(t *testing.T) {
assert := assert.New(t)
tests := map[string]string{
"Document,PDFLoader": "DocumentPDFLoader",
"FooBar,FizzBuzz": "FooBarFizzBuzz",
}
for inputStr, expected := range tests {
input := strings.Split(inputStr, ",")
result := PascalCase(input)
assert.Equal(expected, result)
}
}