summaryrefslogtreecommitdiff
path: root/tests/unit/plugins/irc/test-irc-message.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-06-22 20:38:13 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-06-24 21:02:03 +0200
commitb1cf12700d6c928e0550d97a9c1da7b188f81dc1 (patch)
treea923ed6fd2b5634693f97a449446f35745d84d3c /tests/unit/plugins/irc/test-irc-message.cpp
parent8ea1ee06e5ac18a000788851f807cb4fad3e076c (diff)
downloadweechat-b1cf12700d6c928e0550d97a9c1da7b188f81dc1.zip
irc: add keys/values with tags in output of irc_message_parse_to_hashtable (issue #1654)
Key is "tag_xxx" (where "xxx" is the name of tag) and value is the unescaped tag value.
Diffstat (limited to 'tests/unit/plugins/irc/test-irc-message.cpp')
-rw-r--r--tests/unit/plugins/irc/test-irc-message.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/unit/plugins/irc/test-irc-message.cpp b/tests/unit/plugins/irc/test-irc-message.cpp
index d94d440c5..accd26186 100644
--- a/tests/unit/plugins/irc/test-irc-message.cpp
+++ b/tests/unit/plugins/irc/test-irc-message.cpp
@@ -521,12 +521,16 @@ TEST(IrcMessage, ParseToHashtable)
hashtable = irc_message_parse_to_hashtable (
NULL,
- "@time=2019-08-03T12:13:00.000Z :nick!user@host PRIVMSG #channel "
- ":the message");
+ "@time=2019-08-03T12:13:00.000Z;tag2=value\\sspace "
+ ":nick!user@host PRIVMSG #channel :the message");
CHECK(hashtable);
- STRCMP_EQUAL("time=2019-08-03T12:13:00.000Z",
+ STRCMP_EQUAL("time=2019-08-03T12:13:00.000Z;tag2=value\\sspace",
(const char *)hashtable_get (hashtable, "tags"));
+ STRCMP_EQUAL("2019-08-03T12:13:00.000Z",
+ (const char *)hashtable_get (hashtable, "tag_time"));
+ STRCMP_EQUAL("value space",
+ (const char *)hashtable_get (hashtable, "tag_tag2"));
STRCMP_EQUAL(":nick!user@host PRIVMSG #channel :the message",
(const char *)hashtable_get (hashtable, "message_without_tags"));
STRCMP_EQUAL("nick",
@@ -541,13 +545,13 @@ TEST(IrcMessage, ParseToHashtable)
(const char *)hashtable_get (hashtable, "arguments"));
STRCMP_EQUAL("the message",
(const char *)hashtable_get (hashtable, "text"));
- STRCMP_EQUAL("47",
+ STRCMP_EQUAL("65",
(const char *)hashtable_get (hashtable, "pos_command"));
- STRCMP_EQUAL("55",
+ STRCMP_EQUAL("73",
(const char *)hashtable_get (hashtable, "pos_arguments"));
- STRCMP_EQUAL("55",
+ STRCMP_EQUAL("73",
(const char *)hashtable_get (hashtable, "pos_channel"));
- STRCMP_EQUAL("65",
+ STRCMP_EQUAL("83",
(const char *)hashtable_get (hashtable, "pos_text"));
hashtable_free (hashtable);