дзеркало
https://github.com/quitesimpleorg/qsmaddy.git
synced 2024-11-24 08:12:37 +01:00
test_maddy_strongparser: Add tests to __ tag
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
джерело
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);
|
||||
}
|
||||
}
|
||||
|
Завантаження…
Посилання в новій задачі
Block a user