summaryrefslogtreecommitdiff
path: root/tests/unit/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-03-28 13:40:39 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-03-28 13:40:39 +0100
commitf072eb8d78e7b879add462071ee029d3da893618 (patch)
tree330deaad3ec0ab04f049ab9644b0414a68018c5e /tests/unit/plugins/irc
parent03ffd396a4d7243a4b1c30be54960ea011b38e6b (diff)
downloadweechat-f072eb8d78e7b879add462071ee029d3da893618.zip
tests: add tests on function irc_protocol_get_message_tags
Diffstat (limited to 'tests/unit/plugins/irc')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index e4ee23d2a..55aa6d5d2 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -42,6 +42,7 @@ extern const char *irc_protocol_nick_address (struct t_irc_server *server,
struct t_irc_nick *nick,
const char *nickname,
const char *address);
+extern struct t_hashtable *irc_protocol_get_message_tags (const char *tags);
}
#include "tests/tests.h"
@@ -159,6 +160,39 @@ TEST(IrcProtocol, Tags)
/*
* Tests functions:
+ * irc_protocol_get_message_tags
+ */
+
+TEST(IrcProtocol, GetMessageTags)
+{
+ struct t_hashtable *hashtable;
+
+ POINTERS_EQUAL(NULL, irc_protocol_get_message_tags (NULL));
+ POINTERS_EQUAL(NULL, irc_protocol_get_message_tags (""));
+
+ hashtable = irc_protocol_get_message_tags ("abc");
+ CHECK(hashtable);
+ LONGS_EQUAL(1, hashtable->items_count);
+ POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "abc"));
+ hashtable_free (hashtable);
+
+ hashtable = irc_protocol_get_message_tags ("abc=def");
+ CHECK(hashtable);
+ LONGS_EQUAL(1, hashtable->items_count);
+ STRCMP_EQUAL("def", (const char *)hashtable_get (hashtable, "abc"));
+ hashtable_free (hashtable);
+
+ hashtable = irc_protocol_get_message_tags ("aaa=bbb;ccc;example.com/ddd=eee");
+ CHECK(hashtable);
+ LONGS_EQUAL(3, hashtable->items_count);
+ STRCMP_EQUAL("bbb", (const char *)hashtable_get (hashtable, "aaa"));
+ POINTERS_EQUAL(NULL, (const char *)hashtable_get (hashtable, "ccc"));
+ STRCMP_EQUAL("eee", (const char *)hashtable_get (hashtable, "example.com/ddd"));
+ hashtable_free (hashtable);
+}
+
+/*
+ * Tests functions:
* irc_protocol_parse_time
*/