diff options
Diffstat (limited to 'tests/unit/plugins/irc')
-rw-r--r-- | tests/unit/plugins/irc/test-irc-message.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-message.cpp b/tests/unit/plugins/irc/test-irc-message.cpp index 39a232c5a..3939060e9 100644 --- a/tests/unit/plugins/irc/test-irc-message.cpp +++ b/tests/unit/plugins/irc/test-irc-message.cpp @@ -948,6 +948,24 @@ convert_irc_charset_cb (const void *pointer, void *data, /* * Tests functions: + * irc_message_is_empty + */ + +TEST(IrcMessage, IsEmpty) +{ + LONGS_EQUAL(1, irc_message_is_empty (NULL)); + LONGS_EQUAL(1, irc_message_is_empty ("")); + LONGS_EQUAL(1, irc_message_is_empty ("\n")); + LONGS_EQUAL(1, irc_message_is_empty ("\n\n\n\n\n\n\n\n")); + + LONGS_EQUAL(0, irc_message_is_empty (" ")); + LONGS_EQUAL(0, irc_message_is_empty ("\n ")); + LONGS_EQUAL(0, irc_message_is_empty ("\n \n")); + LONGS_EQUAL(0, irc_message_is_empty ("test")); +} + +/* + * Tests functions: * irc_message_convert_charset */ @@ -1516,6 +1534,12 @@ TEST(IrcMessage, Split) (const char *)hashtable_get (hashtable, "msg1")); hashtable_free (hashtable); + /* PRIVMSG with no content: no split (not allowed) */ + hashtable = irc_message_split (server, "PRIVMSG #channel :"); + CHECK(hashtable); + LONGS_EQUAL(0, hashtable->items_count); + hashtable_free (hashtable); + /* PRIVMSG with small content: no split */ hashtable = irc_message_split (server, "PRIVMSG #channel :test"); CHECK(hashtable); |