summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-03-24 16:56:57 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-03-24 16:56:57 +0100
commit9fac350b3fd9eb9d7f0ed62c7d894c4b76e4fa74 (patch)
treed0c9b563ea63da6f888c8da0feafacdc25f568bc /tests/unit
parentfa931b46eb7737be619c9c6e02be1111c17f0f89 (diff)
downloadweechat-9fac350b3fd9eb9d7f0ed62c7d894c4b76e4fa74.zip
tests: add tests on IRC protocol functions with not enough arguments
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index e0be0ef0a..1ca8b7706 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -306,6 +306,10 @@ TEST(IrcProtocolWithServer, account_without_account_notify_cap)
POINTERS_EQUAL(NULL, ptr_nick->account);
+ /* not enough arguments */
+ server_recv (":alice!user@host ACCOUNT");
+ POINTERS_EQUAL(NULL, ptr_nick->account);
+
server_recv (":alice!user@host ACCOUNT *");
POINTERS_EQUAL(NULL, ptr_nick->account);
@@ -379,6 +383,11 @@ TEST(IrcProtocolWithServer, chghost)
STRCMP_EQUAL("user@host", ptr_nick->host);
+ /* not enough arguments */
+ server_recv (":alice!user@host CHGHOST");
+ server_recv (":alice!user@host CHGHOST user2");
+ STRCMP_EQUAL("user@host", ptr_nick->host);
+
server_recv (":alice!user@host CHGHOST user2 host2");
STRCMP_EQUAL("user2@host2", ptr_nick->host);
@@ -400,6 +409,10 @@ TEST(IrcProtocolWithServer, join)
POINTERS_EQUAL(NULL, ptr_server->channels);
+ /* not enough arguments */
+ server_recv (":alice!user@host JOIN");
+ POINTERS_EQUAL(NULL, ptr_server->channels);
+
server_recv (":alice!user@host JOIN #test");
ptr_channel = ptr_server->channels;
@@ -463,6 +476,11 @@ TEST(IrcProtocolWithServer, kick)
CHECK(ptr_channel->nicks->next_nick);
STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name);
+ /* not enough arguments */
+ server_recv (":alice!user@host KICK");
+ server_recv (":alice!user@host KICK #test");
+ STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name);
+
server_recv (":alice!user@host KICK #test bob :no spam here!");
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
@@ -493,6 +511,10 @@ TEST(IrcProtocolWithServer, kill)
CHECK(ptr_channel->nicks->next_nick);
STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name);
+ /* not enough arguments */
+ server_recv (":alice!user@host KILL");
+ STRCMP_EQUAL("bob", ptr_channel->nicks->next_nick->name);
+
server_recv (":alice!user@host KILL bob :killed by admin");
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
@@ -524,9 +546,10 @@ TEST(IrcProtocolWithServer, mode)
STRCMP_EQUAL(" ", ptr_nick->prefixes);
STRCMP_EQUAL(" ", ptr_nick->prefix);
- /* missing arguments */
+ /* not enough arguments */
server_recv (":admin MODE");
server_recv (":admin MODE #test");
+ POINTERS_EQUAL(NULL, ptr_channel->modes);
/* channel mode */
server_recv (":admin MODE #test +nt");
@@ -589,6 +612,8 @@ TEST(IrcProtocolWithServer, nick)
/* not enough arguments */
server_recv (":alice!user@host NICK");
+ STRCMP_EQUAL("alice", ptr_nick1->name);
+ STRCMP_EQUAL("bob", ptr_nick2->name);
/* new nick for alice */
server_recv (":alice!user@host NICK alice_away");