irc/irc_test.go
blackbeard420 cc8e251c90
Some checks failed
continuous-integration/drone/push Build is failing
reorganized testing a little
2021-10-27 20:09:03 -04:00

52 lines
1.0 KiB
Go

package irc
import (
"log"
"testing"
"time"
)
const (
channel = "#warez"
)
func TestJoinChannel(t *testing.T) {
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
go con.Run()
time.Sleep(5 * time.Second)
log.Printf("%d users in channel %s\n", len(con.userList[channel]), channel)
con.SendQuit("scan complete")
//con.SendPrivmsg("#warez", fmt.Sprintf("\x0356 FUCK YALL BITCHES %d", len(con.userList["#warez"])))
/*
i := 0
for _, v := range con.userList[channel] {
con.SendPrivmsg(channel, fmt.Sprintf("yo %s fuck you", v))
if i >= 5 {
time.Sleep(1000 * time.Millisecond)
i = 0
}
}
*/
}
func TestLusers(t *testing.T) {
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
con.NumericCallback = func(from string, i int, args string) {
if i == RPL_LUSERCLIENT {
log.Printf("luser reply: %s\n", args)
con.SendQuit("scan complete")
}
}
con.Run()
}
func TestParser(t *testing.T) {
log.Printf("testing %s\n", t.Name())
}