summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-03-25 20:48:54 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-03-25 20:48:54 +0100
commitb82a887f2a59951c70315a62a6785b4ad0681ebb (patch)
tree2f533cfb5b8657975332ac6cf11b27e9e4b5c22c
parentcecbad1803c9f4292a3d0ae2a5008b5c8eac8129 (diff)
downloadweechat-b82a887f2a59951c70315a62a6785b4ad0681ebb.zip
tests: add tests on function irc_protocol_cb_part
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index c977f1eb9..e4d0f28dc 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -636,6 +636,37 @@ TEST(IrcProtocolWithServer, nick)
/*
* Tests functions:
+ * irc_protocol_cb_part
+ */
+
+TEST(IrcProtocolWithServer, part)
+{
+ server_recv (":server 001 alice");
+
+ POINTERS_EQUAL(NULL, ptr_server->channels);
+
+ server_recv (":alice!user@host JOIN #test");
+
+ /* not enough arguments */
+ server_recv (":alice!user@host PART");
+ STRCMP_EQUAL("#test", ptr_server->channels->name);
+ CHECK(ptr_server->channels->nicks);
+ LONGS_EQUAL(0, ptr_server->channels->part);
+
+ /* channel not found */
+ server_recv (":alice!user@host PART #xyz");
+ STRCMP_EQUAL("#test", ptr_server->channels->name);
+ CHECK(ptr_server->channels->nicks);
+ LONGS_EQUAL(0, ptr_server->channels->part);
+
+ server_recv (":alice!user@host PART #test");
+ STRCMP_EQUAL("#test", ptr_server->channels->name);
+ POINTERS_EQUAL(NULL, ptr_server->channels->nicks);
+ LONGS_EQUAL(1, ptr_server->channels->part);
+}
+
+/*
+ * Tests functions:
* irc_protocol_cb_001 (empty)
*/