Test for 332 RPL_TOPIC.

This commit is contained in:
Alex Bramley 2011-09-09 23:27:45 +01:00
parent 4008b84db6
commit d4ae3b588d
1 changed files with 29 additions and 0 deletions

View File

@ -475,3 +475,32 @@ func Test324(t *testing.T) {
m.ExpectNothing()
c.ExpectError()
}
// Test the handler for 332 / RPL_TOPIC
func Test332(t *testing.T) {
m, c := setUp(t)
defer tearDown(m, c)
// Create #test1, whose topic we don't know
test1 := c.NewChannel("#test1")
// Assert that it has no topic originally
if test1.Topic != "" {
t.Errorf("Test channel already has a topic.")
}
// Send a 332 reply
c.h_332(parseLine(":irc.server.org 332 test #test1 :something something"))
m.ExpectNothing()
c.ExpectNoErrors()
// Make sure the channel's topic has been changed
if test1.Topic != "something something" {
t.Errorf("Topic of test channel not set correctly.")
}
// Check unknown channel causes an error
c.h_324(parseLine(":irc.server.org 332 test #test2 :dark side"))
m.ExpectNothing()
c.ExpectError()
}