mirror of https://github.com/gissleh/irc.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
652 B
32 lines
652 B
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
|
|
}
|