summaryrefslogtreecommitdiff
path: root/tests/unit/plugins/irc/test-irc-protocol.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-07-21 11:10:29 +0200
committerSébastien Helleu <flashcode@flashtux.org>2022-07-21 11:10:29 +0200
commit569c93c6fb440b986d456ddd2d5dd689ff78fa81 (patch)
treea4756049d7b34ecdf949976b98844b2fecbcba8f /tests/unit/plugins/irc/test-irc-protocol.cpp
parent96ed47126130ac62350aef4a9236009b7fc3cd5f (diff)
downloadweechat-569c93c6fb440b986d456ddd2d5dd689ff78fa81.zip
irc: fix display of QUIT message with an empty trailing parameter (closes #1797)
The regression was introduced with the new way to parse IRC message parameters, in version 3.4.
Diffstat (limited to 'tests/unit/plugins/irc/test-irc-protocol.cpp')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index dc7079c7a..838a0cb8c 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -1551,14 +1551,23 @@ TEST(IrcProtocolWithServer, part)
CHECK(ptr_server->channels->nicks);
LONGS_EQUAL(0, ptr_server->channels->part);
+ /* without part message */
RECV(":alice!user@host PART #test");
CHECK_CHAN("<-- alice (user@host) has left #test");
STRCMP_EQUAL("#test", ptr_server->channels->name);
POINTERS_EQUAL(NULL, ptr_server->channels->nicks);
LONGS_EQUAL(1, ptr_server->channels->part);
+ /* without part message (but empty trailing parameter) */
RECV(":alice!user@host JOIN #test");
+ RECV(":alice!user@host PART #test :");
+ CHECK_CHAN("<-- alice (user@host) has left #test");
+ STRCMP_EQUAL("#test", ptr_server->channels->name);
+ POINTERS_EQUAL(NULL, ptr_server->channels->nicks);
+ LONGS_EQUAL(1, ptr_server->channels->part);
+ /* with part message */
+ RECV(":alice!user@host JOIN #test");
RECV(":alice!user@host PART #test :part message ");
CHECK_CHAN("<-- alice (user@host) has left #test (part message )");
STRCMP_EQUAL("#test", ptr_server->channels->name);
@@ -1783,26 +1792,24 @@ TEST(IrcProtocolWithServer, quit)
ptr_channel = ptr_server->channels;
- RECV(":bob!user@host JOIN #test");
- CHECK_CHAN("--> bob (user@host) has joined #test");
- LONGS_EQUAL(2, ptr_channel->nicks_count);
- STRCMP_EQUAL("alice", ptr_channel->nicks->name);
- STRCMP_EQUAL("bob", ptr_channel->last_nick->name);
-
/* without quit message */
+ RECV(":bob!user@host JOIN #test");
RECV(":bob!user@host QUIT");
CHECK_CHAN("<-- bob (user@host) has quit");
LONGS_EQUAL(1, ptr_channel->nicks_count);
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick);
+ /* without quit message (but empty trailing parameter) */
RECV(":bob!user@host JOIN #test");
- CHECK_CHAN("--> bob (user@host) has joined #test");
- LONGS_EQUAL(2, ptr_channel->nicks_count);
+ RECV(":bob!user@host QUIT :");
+ CHECK_CHAN("<-- bob (user@host) has quit");
+ LONGS_EQUAL(1, ptr_channel->nicks_count);
STRCMP_EQUAL("alice", ptr_channel->nicks->name);
- STRCMP_EQUAL("bob", ptr_channel->last_nick->name);
+ POINTERS_EQUAL(NULL, ptr_channel->nicks->next_nick);
/* with quit message */
+ RECV(":bob!user@host JOIN #test");
RECV(":bob!user@host QUIT :quit message ");
CHECK_CHAN("<-- bob (user@host) has quit (quit message )");
LONGS_EQUAL(1, ptr_channel->nicks_count);