This commit is contained in:
parent
659601e7c0
commit
be45f6f2d9
29
irc_test.go
29
irc_test.go
@ -79,6 +79,35 @@ func TestLusersChannels(t *testing.T) {
|
||||
con.Run()
|
||||
}
|
||||
|
||||
func TestMultiClient(t *testing.T) {
|
||||
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
|
||||
|
||||
chancnt := make(chan int)
|
||||
|
||||
con.NumericCallback = func(from string, i int, args string) {
|
||||
if i == RPL_ENDOFMOTD {
|
||||
con2 := NewConnection("irc.libera.chat:6667", "irc-go66543", "irc-go66543", nil, nil)
|
||||
con2.NumericCallback = func(from string, i int, args string) {
|
||||
if i == RPL_LUSERCHANNELS {
|
||||
s := strings.TrimSpace(strings.Split(args, " ")[1])
|
||||
val, _ := strconv.Atoi(s)
|
||||
chancnt <- val
|
||||
}
|
||||
}
|
||||
go con2.Run()
|
||||
|
||||
go func() {
|
||||
resp := <-chancnt
|
||||
con.SendPrivmsg(channel, fmt.Sprintf("There are %d channels formed on libera", resp))
|
||||
con2.SendQuit("")
|
||||
con.SendQuit("")
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
con.Run()
|
||||
}
|
||||
|
||||
func TestParser(t *testing.T) {
|
||||
log.Printf("testing %s\n", t.Name())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user