From 62365f1c7c39b816b3e8d249e334a59b4f3b4ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 19 Oct 2018 11:31:59 -0300 Subject: [PATCH] test_maddy_strongparser: Add tests to __ tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- tests/maddy/test_maddy_strongparser.cpp | 84 ++++++++++++++++++++----- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/tests/maddy/test_maddy_strongparser.cpp b/tests/maddy/test_maddy_strongparser.cpp index ad70762..e054aa7 100644 --- a/tests/maddy/test_maddy_strongparser.cpp +++ b/tests/maddy/test_maddy_strongparser.cpp @@ -12,33 +12,87 @@ TEST(MADDY_STRONGPARSER, ItReplacesMarkdownWithStrongHTML) { - 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 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 it out" + }, + }; + auto strongParser = std::make_shared(); - 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 it out"; + struct testIt + { + std::string text; + std::string expected; + }; + + std::vector 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 it out" + }, + }; + auto strongParser = std::make_shared(); - 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 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 it out" + }, + }; + auto strongParser = std::make_shared(); - strongParser->Parse(text); - - ASSERT_EQ(expected, text); + for (auto& test : tests) + { + strongParser->Parse(test.text); + ASSERT_EQ(test.expected, test.text); + } }