镜像来自
https://github.com/quitesimpleorg/qsmaddy.git
synced 2024-11-05 09:14:38 +01:00
2ee6840008
* em * s * strong updated regex
45 line
1.3 KiB
C++
45 line
1.3 KiB
C++
/*
|
|
* This project is licensed under the MIT license. For more information see the
|
|
* LICENSE file.
|
|
*/
|
|
#include <memory>
|
|
|
|
#include "gmock/gmock.h"
|
|
|
|
#include "maddy/strongparser.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
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";
|
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
|
|
|
strongParser->Parse(text);
|
|
|
|
ASSERT_EQ(expected, 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";
|
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
|
|
|
strongParser->Parse(text);
|
|
|
|
ASSERT_EQ(expected, 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";
|
|
auto strongParser = std::make_shared<maddy::StrongParser>();
|
|
|
|
strongParser->Parse(text);
|
|
|
|
ASSERT_EQ(expected, text);
|
|
}
|