forked from External/ergo
Restrict idents as other servers do
This commit is contained in:
parent
9f25a42c3d
commit
8cd5db1194
5 changed files with 49 additions and 4 deletions
|
|
@ -140,6 +140,22 @@ func TestIsBoring(t *testing.T) {
|
|||
assertBoring("Νικηφόρος", false)
|
||||
}
|
||||
|
||||
func TestIsIdent(t *testing.T) {
|
||||
assertIdent := func(str string, expected bool) {
|
||||
if isIdent(str) != expected {
|
||||
t.Errorf("expected [%s] to have identness [%t], but got [%t]", str, expected, !expected)
|
||||
}
|
||||
}
|
||||
|
||||
assertIdent("warning", true)
|
||||
assertIdent("sid3225", true)
|
||||
assertIdent("dan.oak25", true)
|
||||
assertIdent("dan.oak[25]", true)
|
||||
assertIdent("phi@#$%ip", false)
|
||||
assertIdent("Νικηφόρος", false)
|
||||
assertIdent("-dan56", false)
|
||||
}
|
||||
|
||||
func TestSkeleton(t *testing.T) {
|
||||
skeleton := func(str string) string {
|
||||
skel, err := Skeleton(str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue