diff options
| author | levlam <levlam@telegram.org> | 2022-07-18 23:40:57 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2022-07-18 23:40:57 +0300 |
| commit | 8e09a835068f6998438330cac929a7897ce0f65b (patch) | |
| tree | 0a001545b32167fadae49803ff494a260095aca8 /test/message_entities.cpp | |
| parent | 585191bb6f8913e9cfa7f8adf957c21bf6872941 (diff) | |
Support custom emoji in MarkdownV2.
Diffstat (limited to 'test/message_entities.cpp')
| -rw-r--r-- | test/message_entities.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/message_entities.cpp b/test/message_entities.cpp index 57fd9d80d..e5393fa0d 100644 --- a/test/message_entities.cpp +++ b/test/message_entities.cpp @@ -1384,6 +1384,16 @@ TEST(MessageEntities, parse_markdown) { check_parse_markdown("🏟 🏟__🏟 _🏟___", "Can't find end of Italic entity at byte offset 23"); check_parse_markdown("🏟 🏟__", "Can't find end of Underline entity at byte offset 9"); check_parse_markdown("🏟 🏟||test\\|", "Can't find end of Spoiler entity at byte offset 9"); + check_parse_markdown("🏟 🏟!", "Character '!' is reserved and must be escaped with the preceding '\\'"); + check_parse_markdown("🏟 🏟![", "Can't find end of CustomEmoji entity at byte offset 9"); + check_parse_markdown("🏟 🏟![👍", "Can't find end of CustomEmoji entity at byte offset 9"); + check_parse_markdown("🏟 🏟![👍]", "Custom emoji entity must contain a tg://emoji URL"); + check_parse_markdown("🏟 🏟; + check_parse_markdown("🏟 🏟", "Custom emoji URL must have scheme tg"); + check_parse_markdown("🏟 🏟", "Custom emoji URL must have host \"emoji\""); + check_parse_markdown("🏟 🏟", "Custom emoji URL must have an emoji identifier"); + check_parse_markdown("🏟 🏟", "Custom emoji URL must have an emoji identifier"); + check_parse_markdown("🏟 🏟", "Invalid custom emoji identifier specified"); check_parse_markdown("", "", {}); check_parse_markdown("\\\\", "\\", {}); @@ -1455,6 +1465,8 @@ TEST(MessageEntities, parse_markdown) { check_parse_markdown("[telegram\\.org](asdasd)", "telegram.org", {}); check_parse_markdown("[telegram\\.org](tg:user?id=123456)", "telegram.org", {{0, 12, td::UserId(static_cast<td::int64>(123456))}}); + check_parse_markdown("🏟 🏟a", "🏟 🏟👍a", + {{td::MessageEntity::Type::CustomEmoji, 5, 2, static_cast<td::int64>(25)}}); } static void check_parse_markdown_v3(td::string text, td::vector<td::MessageEntity> entities, |
