mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
refactor WhoFields to use value receivers
This commit is contained in:
parent
bdfee9cb39
commit
97417f4c32
2 changed files with 46 additions and 14 deletions
|
|
@ -56,3 +56,33 @@ func TestUserMasks(t *testing.T) {
|
|||
t.Error("failure to match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWhoFields(t *testing.T) {
|
||||
var w whoxFields
|
||||
|
||||
if w.Has('a') {
|
||||
t.Error("zero value of whoxFields must be empty")
|
||||
}
|
||||
w = w.Add('a')
|
||||
if !w.Has('a') {
|
||||
t.Error("failed to set and get")
|
||||
}
|
||||
if w.Has('A') {
|
||||
t.Error("false positive")
|
||||
}
|
||||
if w.Has('o') {
|
||||
t.Error("false positive")
|
||||
}
|
||||
w = w.Add('🐬')
|
||||
if w.Has('🐬') {
|
||||
t.Error("should not be able to set invalid who field")
|
||||
}
|
||||
w = w.Add('o')
|
||||
if !w.Has('o') {
|
||||
t.Error("failed to set and get")
|
||||
}
|
||||
w = w.Add('z')
|
||||
if !w.Has('z') {
|
||||
t.Error("failed to set and get")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue