mirror of
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)
|
TEST(MADDY_STRONGPARSER, ItReplacesMarkdownWithStrongHTML)
|
||||||
{
|
{
|
||||||
std::string text = "some text **bla** text testing **it** out";
|
struct testIt
|
||||||
std::string expected = "some text <strong>bla</strong> text testing <strong>it</strong> out";
|
{
|
||||||
|
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>();
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
||||||
|
|
||||||
strongParser->Parse(text);
|
for (auto& test : tests)
|
||||||
|
{
|
||||||
ASSERT_EQ(expected, text);
|
strongParser->Parse(test.text);
|
||||||
|
ASSERT_EQ(test.expected, test.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MADDY_STRONGPARSER, ItReplacesEmphasizedMarkdownNotWithStrongHTML)
|
TEST(MADDY_STRONGPARSER, ItReplacesEmphasizedMarkdownNotWithStrongHTML)
|
||||||
{
|
{
|
||||||
std::string text = "some text *bla* text testing **it** out";
|
struct testIt
|
||||||
std::string expected = "some text *bla* text testing <strong>it</strong> out";
|
{
|
||||||
|
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>();
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
||||||
|
|
||||||
strongParser->Parse(text);
|
for (auto& test : tests)
|
||||||
|
{
|
||||||
ASSERT_EQ(expected, text);
|
strongParser->Parse(test.text);
|
||||||
|
ASSERT_EQ(test.expected, test.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MADDY_STRONGPARSER, ItDoesNotParseInsideInlineCode)
|
TEST(MADDY_STRONGPARSER, ItDoesNotParseInsideInlineCode)
|
||||||
{
|
{
|
||||||
std::string text = "some text **bla** `/**text**/` testing `**it**` out";
|
struct testIt
|
||||||
std::string expected = "some text **bla** `/**text**/` testing `**it**` out";
|
{
|
||||||
|
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>();
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
||||||
|
|
||||||
strongParser->Parse(text);
|
for (auto& test : tests)
|
||||||
|
{
|
||||||
ASSERT_EQ(expected, text);
|
strongParser->Parse(test.text);
|
||||||
|
ASSERT_EQ(test.expected, test.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user