tests: add tests on IRC protocol functions with not enough arguments

v2.8-utf8proc
Sébastien Helleu 2020-03-24 16:56:57 +01:00
parent fa931b46eb
commit 9fac350b3f
1 changed files with 26 additions and 1 deletions

View File

@ -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");