mirror of
https://github.com/fluffle/goirc
synced 2025-05-14 03:23:21 +00:00
Epic final commit for nick/chan/logging/testing refactor.
* Brings logging changes to client library. * Brings state tracker to client library. * Rewrites all tests to use mock logger and mock state tracker. * Makes state tracking optional, finally. * Shaves yaks until they are almost completely bald.
This commit is contained in:
parent
69d52270b6
commit
85097043cf
7 changed files with 525 additions and 577 deletions
|
@ -3,76 +3,76 @@ package client
|
|||
import "testing"
|
||||
|
||||
func TestClientCommands(t *testing.T) {
|
||||
m, c := setUp(t)
|
||||
defer tearDown(m, c)
|
||||
c, s := setUp(t)
|
||||
defer s.tearDown()
|
||||
|
||||
c.Pass("password")
|
||||
m.Expect("PASS password")
|
||||
s.nc.Expect("PASS password")
|
||||
|
||||
c.Nick("test")
|
||||
m.Expect("NICK test")
|
||||
s.nc.Expect("NICK test")
|
||||
|
||||
c.User("test", "Testing IRC")
|
||||
m.Expect("USER test 12 * :Testing IRC")
|
||||
s.nc.Expect("USER test 12 * :Testing IRC")
|
||||
|
||||
c.Raw("JUST a raw :line")
|
||||
m.Expect("JUST a raw :line")
|
||||
s.nc.Expect("JUST a raw :line")
|
||||
|
||||
c.Join("#foo")
|
||||
m.Expect("JOIN #foo")
|
||||
s.nc.Expect("JOIN #foo")
|
||||
|
||||
c.Part("#foo")
|
||||
m.Expect("PART #foo")
|
||||
s.nc.Expect("PART #foo")
|
||||
c.Part("#foo", "Screw you guys...")
|
||||
m.Expect("PART #foo :Screw you guys...")
|
||||
s.nc.Expect("PART #foo :Screw you guys...")
|
||||
|
||||
c.Quit()
|
||||
m.Expect("QUIT :GoBye!")
|
||||
s.nc.Expect("QUIT :GoBye!")
|
||||
c.Quit("I'm going home.")
|
||||
m.Expect("QUIT :I'm going home.")
|
||||
s.nc.Expect("QUIT :I'm going home.")
|
||||
|
||||
c.Whois("somebody")
|
||||
m.Expect("WHOIS somebody")
|
||||
s.nc.Expect("WHOIS somebody")
|
||||
|
||||
c.Who("*@some.host.com")
|
||||
m.Expect("WHO *@some.host.com")
|
||||
s.nc.Expect("WHO *@some.host.com")
|
||||
|
||||
c.Privmsg("#foo", "bar")
|
||||
m.Expect("PRIVMSG #foo :bar")
|
||||
s.nc.Expect("PRIVMSG #foo :bar")
|
||||
|
||||
c.Notice("somebody", "something")
|
||||
m.Expect("NOTICE somebody :something")
|
||||
s.nc.Expect("NOTICE somebody :something")
|
||||
|
||||
c.Ctcp("somebody", "ping", "123456789")
|
||||
m.Expect("PRIVMSG somebody :\001PING 123456789\001")
|
||||
s.nc.Expect("PRIVMSG somebody :\001PING 123456789\001")
|
||||
|
||||
c.CtcpReply("somebody", "pong", "123456789")
|
||||
m.Expect("NOTICE somebody :\001PONG 123456789\001")
|
||||
s.nc.Expect("NOTICE somebody :\001PONG 123456789\001")
|
||||
|
||||
c.Version("somebody")
|
||||
m.Expect("PRIVMSG somebody :\001VERSION\001")
|
||||
s.nc.Expect("PRIVMSG somebody :\001VERSION\001")
|
||||
|
||||
c.Action("#foo", "pokes somebody")
|
||||
m.Expect("PRIVMSG #foo :\001ACTION pokes somebody\001")
|
||||
s.nc.Expect("PRIVMSG #foo :\001ACTION pokes somebody\001")
|
||||
|
||||
c.Topic("#foo")
|
||||
m.Expect("TOPIC #foo")
|
||||
s.nc.Expect("TOPIC #foo")
|
||||
c.Topic("#foo", "la la la")
|
||||
m.Expect("TOPIC #foo :la la la")
|
||||
s.nc.Expect("TOPIC #foo :la la la")
|
||||
|
||||
c.Mode("#foo")
|
||||
m.Expect("MODE #foo")
|
||||
s.nc.Expect("MODE #foo")
|
||||
c.Mode("#foo", "+o somebody")
|
||||
m.Expect("MODE #foo +o somebody")
|
||||
s.nc.Expect("MODE #foo +o somebody")
|
||||
|
||||
c.Away()
|
||||
m.Expect("AWAY")
|
||||
s.nc.Expect("AWAY")
|
||||
c.Away("Dave's not here, man.")
|
||||
m.Expect("AWAY :Dave's not here, man.")
|
||||
s.nc.Expect("AWAY :Dave's not here, man.")
|
||||
|
||||
c.Invite("somebody", "#foo")
|
||||
m.Expect("INVITE somebody #foo")
|
||||
s.nc.Expect("INVITE somebody #foo")
|
||||
|
||||
c.Oper("user", "pass")
|
||||
m.Expect("OPER user pass")
|
||||
s.nc.Expect("OPER user pass")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue