mirror da
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>
This commit is contained in:
parent
eb2b4fa929
commit
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);
|
||||
}
|
||||
}
|
||||
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user