LUSERCHANNEL/LUSERCLIENT handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a89349d1e3
commit
659601e7c0
@ -1,9 +1,10 @@
|
|||||||
package irc
|
package irc
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RPL_LUSERCLIENT = 251
|
RPL_LUSERCLIENT = 251
|
||||||
RPL_NAMREPLY = 353
|
RPL_LUSERCHANNELS = 254
|
||||||
RPL_ENDOFMOTD = 376
|
RPL_NAMREPLY = 353
|
||||||
|
RPL_ENDOFMOTD = 376
|
||||||
|
|
||||||
ERR_NOSUCHNICK = 401
|
ERR_NOSUCHNICK = 401
|
||||||
)
|
)
|
||||||
|
23
irc_test.go
23
irc_test.go
@ -3,6 +3,7 @@ package irc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -40,7 +41,6 @@ func TestLusers(t *testing.T) {
|
|||||||
|
|
||||||
con.NumericCallback = func(from string, i int, args string) {
|
con.NumericCallback = func(from string, i int, args string) {
|
||||||
if i == RPL_LUSERCLIENT {
|
if i == RPL_LUSERCLIENT {
|
||||||
log.Printf("luser reply: %s\n", args)
|
|
||||||
con.SendJoin(channel)
|
con.SendJoin(channel)
|
||||||
|
|
||||||
s := strings.Split(args, ":")
|
s := strings.Split(args, ":")
|
||||||
@ -58,6 +58,27 @@ func TestLusers(t *testing.T) {
|
|||||||
con.Run()
|
con.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLusersChannels(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_LUSERCHANNELS {
|
||||||
|
con.SendJoin(channel)
|
||||||
|
|
||||||
|
s := strings.TrimSpace(strings.Split(args, " ")[1])
|
||||||
|
val, err := strconv.Atoi(s)
|
||||||
|
if err == nil {
|
||||||
|
con.SendPrivmsg(channel, fmt.Sprintf("There are %d channels formed", val))
|
||||||
|
} else {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
con.SendQuit("scan complete")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
con.Run()
|
||||||
|
}
|
||||||
|
|
||||||
func TestParser(t *testing.T) {
|
func TestParser(t *testing.T) {
|
||||||
log.Printf("testing %s\n", t.Name())
|
log.Printf("testing %s\n", t.Name())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user