|
@@ -128,18 +128,6 @@ func TestCasefoldName(t *testing.T) {
|
128
|
128
|
}
|
129
|
129
|
}
|
130
|
130
|
|
131
|
|
-func TestIsBoring(t *testing.T) {
|
132
|
|
- assertBoring := func(str string, expected bool) {
|
133
|
|
- if isBoring(str) != expected {
|
134
|
|
- t.Errorf("expected [%s] to have boringness [%t], but got [%t]", str, expected, !expected)
|
135
|
|
- }
|
136
|
|
- }
|
137
|
|
-
|
138
|
|
- assertBoring("warning", true)
|
139
|
|
- assertBoring("phi|ip", false)
|
140
|
|
- assertBoring("Νικηφόρος", false)
|
141
|
|
-}
|
142
|
|
-
|
143
|
131
|
func TestIsIdent(t *testing.T) {
|
144
|
132
|
assertIdent := func(str string, expected bool) {
|
145
|
133
|
if isIdent(str) != expected {
|
|
@@ -165,15 +153,15 @@ func TestSkeleton(t *testing.T) {
|
165
|
153
|
return skel
|
166
|
154
|
}
|
167
|
155
|
|
168
|
|
- if skeleton("warning") == skeleton("waming") {
|
169
|
|
- t.Errorf("Oragono shouldn't consider rn confusable with m")
|
|
156
|
+ if skeleton("warning") != skeleton("waming") {
|
|
157
|
+ t.Errorf("i give up, Oragono should consider rn confusable with m")
|
170
|
158
|
}
|
171
|
159
|
|
172
|
160
|
if skeleton("Phi|ip") != "philip" {
|
173
|
161
|
t.Errorf("but we still consider pipe confusable with l")
|
174
|
162
|
}
|
175
|
163
|
|
176
|
|
- if skeleton("smt") != "smt" {
|
|
164
|
+ if skeleton("smt") != skeleton("smt") {
|
177
|
165
|
t.Errorf("fullwidth characters should skeletonize to plain old ascii characters")
|
178
|
166
|
}
|
179
|
167
|
|
|
@@ -181,7 +169,7 @@ func TestSkeleton(t *testing.T) {
|
181
|
169
|
t.Errorf("after skeletonizing, we should casefold")
|
182
|
170
|
}
|
183
|
171
|
|
184
|
|
- if skeleton("smt") != "smt" {
|
|
172
|
+ if skeleton("smt") != skeleton("smt") {
|
185
|
173
|
t.Errorf("our friend lover successfully tricked the skeleton algorithm!")
|
186
|
174
|
}
|
187
|
175
|
|
|
@@ -189,6 +177,10 @@ func TestSkeleton(t *testing.T) {
|
189
|
177
|
t.Errorf("we must protect against cyrillic homoglyph attacks")
|
190
|
178
|
}
|
191
|
179
|
|
|
180
|
+ if skeleton("еmily") != skeleton("emily") {
|
|
181
|
+ t.Errorf("we must protect against cyrillic homoglyph attacks")
|
|
182
|
+ }
|
|
183
|
+
|
192
|
184
|
if skeleton("РОТАТО") != "potato" {
|
193
|
185
|
t.Errorf("we must protect against cyrillic homoglyph attacks")
|
194
|
186
|
}
|