From 8fc23d5c17fb4798f5ecb58f7677068ce7d5de2c Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Tue, 23 Aug 2011 11:03:59 +0100 Subject: [PATCH] Test CTCP handler. --- client/handlers_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/client/handlers_test.go b/client/handlers_test.go index 223ba2d..6e4ecf7 100644 --- a/client/handlers_test.go +++ b/client/handlers_test.go @@ -119,3 +119,25 @@ func TestNICK(t *testing.T) { timer.Stop() } } + +func TestCTCP(t *testing.T) { + m, c := setUp(t) + + // Call handler with CTCP VERSION + c.h_CTCP(parseLine(":blah!moo@cows.com PRIVMSG test :\001VERSION\001")) + + // Expect a version reply + m.Expect("NOTICE blah :\001VERSION powered by goirc...\001") + + // Call handler with CTCP PING + c.h_CTCP(parseLine(":blah!moo@cows.com PRIVMSG test :\001PING 1234567890\001")) + + // Expect a ping reply + m.Expect("NOTICE blah :\001PING 1234567890\001") + + // Call handler with CTCP UNKNOWN + c.h_CTCP(parseLine(":blah!moo@cows.com PRIVMSG test :\001UNKNOWN ctcp\001")) + + // Expect nothing in reply + m.ExpectNothing() +}