diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-25 19:48:41 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-25 19:48:41 +0200 |
commit | 7684d5a3d1a6d067cb7e1a4f9874e962f04f893e (patch) | |
tree | 9dabc1848dbb69c965d37bb0201375845b5d837f | |
parent | 2488466b0cc9e26db505614424829ae4f9717950 (diff) | |
download | weechat-7684d5a3d1a6d067cb7e1a4f9874e962f04f893e.zip |
tests: add test of IRC message split with newline but no server
-rw-r--r-- | tests/unit/plugins/irc/test-irc-message.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-message.cpp b/tests/unit/plugins/irc/test-irc-message.cpp index fe0248608..e110ffa99 100644 --- a/tests/unit/plugins/irc/test-irc-message.cpp +++ b/tests/unit/plugins/irc/test-irc-message.cpp @@ -1997,6 +1997,21 @@ TEST(IrcMessage, Split) hashtable_remove (server->cap_list, "batch"); hashtable_remove (server->cap_list, "draft/multiline"); + /* PRIVMSG with newlines but no server: BATCH is not used */ + hashtable = irc_message_split (NULL, "PRIVMSG #channel :test\n\nline 3"); + CHECK(hashtable); + LONGS_EQUAL(7, hashtable->items_count); + STRCMP_EQUAL("3", (const char *)hashtable_get (hashtable, "count")); + STRCMP_EQUAL("PRIVMSG #channel :test", + (const char *)hashtable_get (hashtable, "msg1")); + STRCMP_EQUAL("test", (const char *)hashtable_get (hashtable, "args1")); + STRCMP_EQUAL("PRIVMSG #channel :", + (const char *)hashtable_get (hashtable, "msg2")); + STRCMP_EQUAL("", (const char *)hashtable_get (hashtable, "args2")); + STRCMP_EQUAL("PRIVMSG #channel :line 3", + (const char *)hashtable_get (hashtable, "msg3")); + STRCMP_EQUAL("line 3", (const char *)hashtable_get (hashtable, "args3")); + /* 005: no split */ hashtable = irc_message_split (server, "005 nick " MSG_005); CHECK(hashtable); |