1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-05-15 12:03:21 +00:00

NewNick handler that doesn't vary nick length. Fixes #108. Sort of.

This commit is contained in:
Alex Bramley 2019-10-17 20:27:52 +01:00
parent 0dc1109b0d
commit b2c51c13c6
3 changed files with 53 additions and 8 deletions

View file

@ -583,3 +583,24 @@ func TestRateLimit(t *testing.T) {
t.Errorf("l=%d, badness=%d", l, c.badness)
}
}
func TestDefaultNewNick(t *testing.T) {
tests := []struct{ in, want string }{
{"", "_"},
{"0", "1"},
{"9", "0"},
{"A", "B"},
{"Z", "["},
{"_", "`"},
{"`", "a"},
{"}", "A"},
{"-", "_"},
{"fluffle", "flufflf"},
}
for _, test := range tests {
if got := DefaultNewNick(test.in); got != test.want {
t.Errorf("DefaultNewNick(%q) = %q, want %q", test.in, got, test.want)
}
}
}