Add get_first_url to test.

This commit is contained in:
levlam 2023-10-19 13:46:36 +03:00
parent a7e98779f0
commit 4a809ed51a

View File

@ -1223,6 +1223,7 @@ TEST(MessageEntities, is_visible_url) {
entities.emplace_back(td::MessageEntity::Type::TextUrl, 0, 1, "telegrab.org"); entities.emplace_back(td::MessageEntity::Type::TextUrl, 0, 1, "telegrab.org");
td::fix_formatted_text(str, entities, false, false, false, false, true).ensure(); td::fix_formatted_text(str, entities, false, false, false, false, true).ensure();
td::FormattedText text{std::move(str), std::move(entities)}; td::FormattedText text{std::move(str), std::move(entities)};
ASSERT_EQ(td::get_first_url(text), "telegrab.org");
ASSERT_TRUE(!td::is_visible_url(text, "telegrab.org")); ASSERT_TRUE(!td::is_visible_url(text, "telegrab.org"));
ASSERT_TRUE(td::is_visible_url(text, "telegram.org")); ASSERT_TRUE(td::is_visible_url(text, "telegram.org"));
ASSERT_TRUE(td::is_visible_url(text, "telegran.org")); ASSERT_TRUE(td::is_visible_url(text, "telegran.org"));