1
0
зеркало из https://github.com/quitesimpleorg/qsmaddy.git synced 2024-11-21 15:17:52 +01:00

test_maddy_strongparser: Add tests to __ tag

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Этот коммит содержится в:
Patrick José Pereira 2018-10-19 11:31:59 -03:00
родитель eb2b4fa929
Коммит 62365f1c7c

Просмотреть файл

@ -12,33 +12,87 @@
TEST(MADDY_STRONGPARSER, ItReplacesMarkdownWithStrongHTML)
{
std::string text = "some text **bla** text testing **it** out";
std::string expected = "some text <strong>bla</strong> text testing <strong>it</strong> out";
struct testIt
{
std::string text;
std::string expected;
};
std::vector<testIt> tests
{
{
"some text **bla** text testing **it** out",
"some text <strong>bla</strong> text testing <strong>it</strong> out"
},
{
"some text __bla__ text testing __it__ out",
"some text <strong>bla</strong> text testing <strong>it</strong> out"
},
};
auto strongParser = std::make_shared<maddy::StrongParser>();
strongParser->Parse(text);
ASSERT_EQ(expected, text);
for (auto& test : tests)
{
strongParser->Parse(test.text);
ASSERT_EQ(test.expected, test.text);
}
}
TEST(MADDY_STRONGPARSER, ItReplacesEmphasizedMarkdownNotWithStrongHTML)
{
std::string text = "some text *bla* text testing **it** out";
std::string expected = "some text *bla* text testing <strong>it</strong> out";
struct testIt
{
std::string text;
std::string expected;
};
std::vector<testIt> tests
{
{
"some text *bla* text testing **it** out",
"some text *bla* text testing <strong>it</strong> out"
},
{
"some text _bla_ text testing __it__ out",
"some text _bla_ text testing <strong>it</strong> out"
},
};
auto strongParser = std::make_shared<maddy::StrongParser>();
strongParser->Parse(text);
ASSERT_EQ(expected, text);
for (auto& test : tests)
{
strongParser->Parse(test.text);
ASSERT_EQ(test.expected, test.text);
}
}
TEST(MADDY_STRONGPARSER, ItDoesNotParseInsideInlineCode)
{
std::string text = "some text **bla** `/**text**/` testing `**it**` out";
std::string expected = "some text **bla** `/**text**/` testing `**it**` out";
struct testIt
{
std::string text;
std::string expected;
};
std::vector<testIt> tests
{
{
"some text **bla** `/**text**/` testing `**it**` out",
"some text **bla** `/**text**/` testing `**it**` out",
},
{
"some text _bla_ text testing __it__ out",
"some text _bla_ text testing <strong>it</strong> out"
},
};
auto strongParser = std::make_shared<maddy::StrongParser>();
strongParser->Parse(text);
ASSERT_EQ(expected, text);
for (auto& test : tests)
{
strongParser->Parse(test.text);
ASSERT_EQ(test.expected, test.text);
}
}