forked from External/ergo
fix #307
This commit is contained in:
parent
50dc265e4d
commit
bd40b46639
5 changed files with 223 additions and 138 deletions
36
irc/usermaskset_test.go
Normal file
36
irc/usermaskset_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue