-
Notifications
You must be signed in to change notification settings - Fork 1
/
no_test.go
77 lines (64 loc) · 2.11 KB
/
no_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
package changecase
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestNo(t *testing.T) {
expectations := [][]string{
// Single words.
[]string{"test", "test"},
[]string{"TEST", "test"},
// Camel case.
[]string{"testString", "test string"},
[]string{"testString123", "test string123"},
[]string{"testString_1_2_3", "test string 1 2 3"},
[]string{"x_256", "x 256"},
[]string{"anHTMLTag", "an html tag"},
[]string{"ID123String", "id123 string"},
[]string{"Id123String", "id123 string"},
[]string{"foo bar123", "foo bar123"},
[]string{"a1bStar", "a1b star"},
// Constant case.
[]string{"CONSTANT_CASE ", "constant case"},
[]string{"CONST123_FOO", "const123 foo"},
// Random cases.
[]string{"FOO_bar", "foo bar"},
// Non-alphanumeric separators.
[]string{"dot.case", "dot case"},
[]string{"path/case", "path case"},
[]string{"snake_case", "snake case"},
[]string{"snake_case123", "snake case123"},
[]string{"snake_case_123", "snake case 123"},
// Punctuation.
[]string{`"quotes"`, "quotes"},
// Space between number parts.
[]string{"version 0.45.0", "version 0 45 0"},
[]string{"version 0..78..9", "version 0 78 9"},
[]string{"version 4_99/4", "version 4 99 4"},
// Whitespace.
[]string{" test ", "test"},
// Non-ascii characters.
[]string{"español", "español"},
[]string{"Beyoncé Knowles", "beyoncé knowles"},
[]string{"Iñtërnâtiônàlizætiøn", "iñtërnâtiônàlizætiøn"},
// Number string input.
[]string{"something_2014_other", "something 2014 other"},
// https://github.com/blakeembrey/change-case/issues/21
[]string{"amazon s3 data", "amazon s3 data"},
[]string{"foo_13_bar", "foo 13 bar"},
[]string{"12months", "12months"},
[]string{"256Colors", "256 colors"},
[]string{"256colors", "256colors"},
[]string{"16Colors", "16 colors"},
[]string{"16colors", "16colors"},
[]string{"8Colors", "8 colors"},
[]string{"8colors", "8colors"},
[]string{"I16n", "i16n"},
[]string{"facebookAPI", "facebook api"},
}
for _, pair := range expectations {
s := pair[0]
expected := pair[1]
assert.Equal(t, expected, No(s))
}
}