aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-02-24 17:21:52 +0300
committerlevlam <levlam@telegram.org>2026-02-24 17:21:52 +0300
commit9495cc597686ba2f18b0a969d195b701ed320077 (patch)
treeb74fa027a3c4acfe54898c55b3fe17064c83fc19 /test
parent3217864e28da36d6e6a741cc140d705e67ac8c4f (diff)
Support "tg-time" tags.
Diffstat (limited to 'test')
-rw-r--r--test/message_entities.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/message_entities.cpp b/test/message_entities.cpp
index c9928b843..ecf12c1f4 100644
--- a/test/message_entities.cpp
+++ b/test/message_entities.cpp
@@ -1381,6 +1381,24 @@ TEST(MessageEntities, parse_html) {
check_parse_html("🏟 🏟<b aba = caba><tg-emoji emoji-id=\"1\">🏟</tg-emoji>1</b>", "🏟 🏟🏟1",
{{td::MessageEntity::Type::Bold, 5, 3},
{td::MessageEntity::Type::CustomEmoji, 5, 2, td::CustomEmojiId(static_cast<td::int64>(1))}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"r\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 1}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"t\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 2}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"T\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 4}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"d\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 8}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"D\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 16}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"w\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 32}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"W\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 32}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"tttTTdDwW\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "➡️ ➡️➡️ ➡️➡️ ➡️",
+ {{5, 5, 12345, 62}, {td::MessageEntity::Type::Bold, 10, 5}});
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"rt\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "Invalid date format used");
+ check_parse_html("➡️ ➡️<tg-time unix = \"12345\", format = \"ts\">➡️ ➡️</tg-time><b>➡️ ➡️</b>", "Invalid date format used");
check_parse_html("<blockquote cite=\"\" askdlbas nasjdbaj nj12b3>a&lt;<pre >b;</></>", "a<b;",
{{td::MessageEntity::Type::BlockQuote, 0, 4}, {td::MessageEntity::Type::Pre, 2, 2}});
check_parse_html("<blockquote expandable>a&lt;<pre >b;</></>", "a<b;",