Browse Source
Added more test utilities for client_test.go, added NAMES and MODE handling for channels
master
Added more test utilities for client_test.go, added NAMES and MODE handling for channels
master
Gisle Aune
7 years ago
6 changed files with 232 additions and 45 deletions
-
53channel.go
-
40client.go
-
38client_test.go
-
32internal/irctest/assert.go
-
90internal/irctest/interaction.go
-
24isupport/isupport.go
@ -0,0 +1,32 @@ |
|||
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 |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue