Mirror of github.com/gissleh/irc
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
650 B

package irctest
import (
"errors"
"strings"
"testing"
"github.com/gissleh/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
}