goirc/client/commands_test.go

85 lines
1.8 KiB
Go
Raw Normal View History

2011-08-21 12:38:51 +00:00
package client
import "testing"
func TestClientCommands(t *testing.T) {
c, s := setUp(t)
defer s.tearDown()
2011-08-21 12:38:51 +00:00
c.Pass("password")
s.nc.Expect("PASS password")
2011-08-21 12:38:51 +00:00
c.Nick("test")
s.nc.Expect("NICK test")
2011-08-21 12:38:51 +00:00
c.User("test", "Testing IRC")
s.nc.Expect("USER test 12 * :Testing IRC")
2011-08-21 12:38:51 +00:00
c.Raw("JUST a raw :line")
s.nc.Expect("JUST a raw :line")
2011-08-21 12:38:51 +00:00
c.Join("#foo")
s.nc.Expect("JOIN #foo")
2011-08-21 12:38:51 +00:00
c.Part("#foo")
s.nc.Expect("PART #foo")
2011-08-21 12:38:51 +00:00
c.Part("#foo", "Screw you guys...")
s.nc.Expect("PART #foo :Screw you guys...")
2011-08-21 12:38:51 +00:00
c.Quit()
s.nc.Expect("QUIT :GoBye!")
2011-08-21 12:38:51 +00:00
c.Quit("I'm going home.")
s.nc.Expect("QUIT :I'm going home.")
2011-08-21 12:38:51 +00:00
c.Whois("somebody")
s.nc.Expect("WHOIS somebody")
2011-08-21 12:38:51 +00:00
c.Who("*@some.host.com")
s.nc.Expect("WHO *@some.host.com")
2011-08-21 12:38:51 +00:00
c.Privmsg("#foo", "bar")
s.nc.Expect("PRIVMSG #foo :bar")
2011-08-21 12:38:51 +00:00
c.Notice("somebody", "something")
s.nc.Expect("NOTICE somebody :something")
2011-08-21 12:38:51 +00:00
c.Ctcp("somebody", "ping", "123456789")
s.nc.Expect("PRIVMSG somebody :\001PING 123456789\001")
2011-08-21 12:38:51 +00:00
c.CtcpReply("somebody", "pong", "123456789")
s.nc.Expect("NOTICE somebody :\001PONG 123456789\001")
2011-08-21 12:38:51 +00:00
c.Version("somebody")
s.nc.Expect("PRIVMSG somebody :\001VERSION\001")
2011-08-21 12:38:51 +00:00
c.Action("#foo", "pokes somebody")
s.nc.Expect("PRIVMSG #foo :\001ACTION pokes somebody\001")
2011-08-21 12:38:51 +00:00
c.Topic("#foo")
s.nc.Expect("TOPIC #foo")
2011-08-21 12:38:51 +00:00
c.Topic("#foo", "la la la")
s.nc.Expect("TOPIC #foo :la la la")
2011-08-21 12:38:51 +00:00
c.Mode("#foo")
s.nc.Expect("MODE #foo")
2011-08-21 12:38:51 +00:00
c.Mode("#foo", "+o somebody")
s.nc.Expect("MODE #foo +o somebody")
2011-08-21 12:38:51 +00:00
c.Away()
s.nc.Expect("AWAY")
2011-08-21 12:38:51 +00:00
c.Away("Dave's not here, man.")
s.nc.Expect("AWAY :Dave's not here, man.")
2011-08-21 12:38:51 +00:00
c.Invite("somebody", "#foo")
s.nc.Expect("INVITE somebody #foo")
2011-08-21 12:38:51 +00:00
c.Oper("user", "pass")
s.nc.Expect("OPER user pass")
c.Ping("woot")
s.nc.Expect("PING :woot")
c.Pong("pwoot")
s.nc.Expect("PONG :pwoot")
2011-08-21 12:38:51 +00:00
}