multiclient test
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
blackbeard420 2021-10-27 21:34:05 -04:00
parent 659601e7c0
commit be45f6f2d9

View File

@ -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())
}