镜像自地址
https://github.com/quitesimpleorg/qsmaddy.git
已同步 2025-12-19 04:31:44 +01:00
initial release 1.0.0
这个提交包含在:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This project is licensed under the MIT license. For more information see the
|
||||
* LICENSE file.
|
||||
*/
|
||||
#include <memory>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
#include "maddy/paragraphparser.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
class MADDY_PARAGRAPHPARSER : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
std::shared_ptr<maddy::ParagraphParser> pParser;
|
||||
|
||||
void
|
||||
SetUp() override
|
||||
{
|
||||
this->pParser = std::make_shared<maddy::ParagraphParser>(
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
TEST_F(MADDY_PARAGRAPHPARSER, IsStartingLineReturnsTrueWhenFacedWithThreeDashes)
|
||||
{
|
||||
ASSERT_TRUE(maddy::ParagraphParser::IsStartingLine("---"));
|
||||
}
|
||||
|
||||
TEST_F(MADDY_PARAGRAPHPARSER, IsFinishedReturnsFalseInTheBeginning)
|
||||
{
|
||||
ASSERT_FALSE(pParser->IsFinished());
|
||||
}
|
||||
|
||||
TEST_F(MADDY_PARAGRAPHPARSER, ItReplacesMarkdownWithAnHtmlLine)
|
||||
{
|
||||
std::vector<std::string> markdown = {
|
||||
"Some text"
|
||||
, "and some other text"
|
||||
, ""
|
||||
};
|
||||
std::string expected = "<p>Some text and some other text </p>";
|
||||
|
||||
for (std::string md : markdown)
|
||||
{
|
||||
pParser->AddLine(md);
|
||||
}
|
||||
ASSERT_TRUE(pParser->IsFinished());
|
||||
|
||||
std::stringstream& output(pParser->GetResult());
|
||||
const std::string& outputString = output.str();
|
||||
|
||||
ASSERT_EQ(expected, outputString);
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户