1
0
Fork 0
forked from External/ergo
This commit is contained in:
Shivaram Lingamneni 2020-10-21 11:08:55 -04:00
parent 50dc265e4d
commit bd40b46639
5 changed files with 223 additions and 138 deletions

36
irc/usermaskset_test.go Normal file
View file

@ -0,0 +1,36 @@
// Copyright (c) 2020 Shivaram Lingamneni
// released under the MIT license
package irc
import (
"testing"
)
func TestUserMaskSet(t *testing.T) {
s := NewUserMaskSet()
if s.Match("horse!~evan@tor-network.onion") {
t.Errorf("empty set should not match anything")
}
s.Add("m:horse!*@*", "", "")
if s.Match("horse!~evan@tor-network.onion") {
t.Errorf("mute extbans should not Match(), only MatchMute()")
}
s.Add("*!~evan@*", "", "")
if !s.Match("horse!~evan@tor-network.onion") {
t.Errorf("expected Match() failed")
}
if s.Match("horse!~horse@tor-network.onion") {
t.Errorf("unexpected Match() succeeded")
}
if !s.MatchMute("horse!~evan@tor-network.onion") {
t.Errorf("expected MatchMute() failed")
}
if s.MatchMute("evan!~evan@tor-network.onion") {
t.Errorf("unexpected MatchMute() succeeded")
}
}