mirror of
https://github.com/gissleh/irc.git
synced 2026-10-24 10:22:54 +00:00
33 lines
652 B
Go
33 lines
652 B
Go
package irctest
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.aiterp.net/gisle/irc"
|
|
)
|
|
|
|
// AssertUserlist compares the userlist to a list of prefixed nicks
|
|
func AssertUserlist(t *testing.T, channel *irc.Channel, assertedOrder ...string) error {
|
|
users := channel.UserList().Users()
|
|
order := make([]string, 0, len(users))
|
|
for _, user := range users {
|
|
order = append(order, user.PrefixedNick)
|
|
}
|
|
|
|
orderA := strings.Join(order, ", ")
|
|
orderB := strings.Join(assertedOrder, ", ")
|
|
|
|
if orderA != orderB {
|
|
t.Logf("Userlist: %s", orderA)
|
|
t.Logf("Asserted: %s", orderB)
|
|
|
|
t.Fail()
|
|
|
|
return errors.New("Userlists does not match")
|
|
}
|
|
|
|
return nil
|
|
}
|