mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
fix #331
This commit is contained in:
parent
07bb38ecdf
commit
938ce7e435
4 changed files with 100 additions and 36 deletions
|
|
@ -188,3 +188,27 @@ func TestSkeleton(t *testing.T) {
|
|||
// should not raise an error:
|
||||
skeleton("けらんぐ")
|
||||
}
|
||||
|
||||
func TestCanonicalizeMaskWildcard(t *testing.T) {
|
||||
tester := func(input, expected string, expectedErr error) {
|
||||
out, err := CanonicalizeMaskWildcard(input)
|
||||
if out != expected {
|
||||
t.Errorf("expected %s to canonicalize to %s, instead %s", input, expected, out)
|
||||
}
|
||||
if err != expectedErr {
|
||||
t.Errorf("expected %s to produce error %v, instead %v", input, expectedErr, err)
|
||||
}
|
||||
}
|
||||
|
||||
tester("shivaram", "shivaram!*@*", nil)
|
||||
tester("slingamn!shivaram", "slingamn!shivaram@*", nil)
|
||||
tester("ברוך", "ברוך!*@*", nil)
|
||||
tester("hacker@monad.io", "*!hacker@monad.io", nil)
|
||||
tester("Evan!hacker@monad.io", "evan!hacker@monad.io", nil)
|
||||
tester("РОТАТО!Potato", "ротато!potato@*", nil)
|
||||
tester("tkadich*", "tkadich*!*@*", nil)
|
||||
tester("SLINGAMN!*@*", "slingamn!*@*", nil)
|
||||
tester("slingamn!shivaram*", "slingamn!shivaram*@*", nil)
|
||||
tester("slingamn!", "slingamn!*@*", nil)
|
||||
tester("shivaram*@good-fortune", "*!shivaram*@good-fortune", nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue