summaryrefslogtreecommitdiff
path: root/tests/unit/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-14 21:25:20 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-14 21:25:20 +0200
commitbd4507e99dbbf9105d566e22e0bca8631f8016b6 (patch)
tree36c4ef7749b2791563d28957fa3eecb5cf0e5dc4 /tests/unit/plugins
parent46b9428f9ecb611ed1e07cf5c098a4c7cca54b17 (diff)
downloadweechat-bd4507e99dbbf9105d566e22e0bca8631f8016b6.zip
irc: fix format of IRC tags displayed in messages (closes #1929)
Changes: - use "=" to separate key from value, add it only if value is set (any string, including empty string) - do not convert "_" to "-" in key
Diffstat (limited to 'tests/unit/plugins')
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index a6a4f1b68..4bde26ec8 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -261,6 +261,8 @@ TEST(IrcProtocol, Tags)
NULL, NULL);
hashtable_set (tags_2, "key1", "value1");
hashtable_set (tags_2, "key_2,comma", "value2,comma");
+ hashtable_set (tags_2, "key_3_empty", "");
+ hashtable_set (tags_2, "key_4_null", NULL);
POINTERS_EQUAL(NULL, irc_protocol_tags (NULL, NULL, NULL, NULL, NULL, NULL));
@@ -275,13 +277,16 @@ TEST(IrcProtocol, Tags)
irc_protocol_tags (NULL, "privmsg", tags_empty, NULL, NULL, NULL));
STRCMP_EQUAL("irc_join,log4",
irc_protocol_tags (NULL, "join", tags_empty, NULL, NULL, NULL));
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,log1",
irc_protocol_tags (NULL, "privmsg", tags_1, NULL, NULL, NULL));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,log4",
irc_protocol_tags (NULL, "join", tags_1, NULL, NULL, NULL));
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,"
+ "irc_tag_key_2;comma=value2;comma,irc_tag_key_3_empty=,"
+ "irc_tag_key_4_null,log1",
irc_protocol_tags (NULL, "privmsg", tags_2, NULL, NULL, NULL));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,log4",
irc_protocol_tags (NULL, "join", tags_2, NULL, NULL, NULL));
/* command + extra_tags */
@@ -295,32 +300,34 @@ TEST(IrcProtocol, Tags)
irc_protocol_tags (NULL, "join", NULL, "tag1,tag2", NULL, NULL));
/* command + irc_msg_tags + extra_tags + nick */
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,log1",
irc_protocol_tags (NULL, "privmsg", tags_2, "tag1,tag2", "", NULL));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,log4",
irc_protocol_tags (NULL, "join", tags_2, "tag1,tag2", "", NULL));
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_alice,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_alice,log1",
irc_protocol_tags (NULL, "privmsg", tags_2, "tag1,tag2", "alice", NULL));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_bob,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_bob,log4",
irc_protocol_tags (NULL, "join", tags_2, "tag1,tag2", "bob", NULL));
/* command + irc_msg_tags + extra_tags + nick + address */
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_alice,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_alice,log1",
irc_protocol_tags (NULL, "privmsg", tags_2, "tag1,tag2", "alice", ""));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_bob,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_bob,log4",
irc_protocol_tags (NULL, "join", tags_2, "tag1,tag2", "bob", ""));
- STRCMP_EQUAL("irc_privmsg,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_alice,host_example.com,log1",
+ STRCMP_EQUAL("irc_privmsg,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_alice,"
+ "host_example.com,log1",
irc_protocol_tags (NULL, "privmsg", tags_2, "tag1,tag2", "alice",
"example.com"));
- STRCMP_EQUAL("irc_join,irc_tag_key1_value1,irc_tag_key-2;comma_value2;comma,"
- "tag1,tag2,nick_bob,host_example.com,log4",
+ STRCMP_EQUAL("irc_join,irc_tag_key1=value1,irc_tag_key_2;comma=value2;comma,"
+ "irc_tag_key_3_empty=,irc_tag_key_4_null,tag1,tag2,nick_bob,"
+ "host_example.com,log4",
irc_protocol_tags (NULL, "join", tags_2, "tag1,tag2", "bob",
"example.com"));