/* * This project is licensed under the MIT license. For more information see the * LICENSE file. */ #include #include "gmock/gmock.h" #include "maddy/paragraphparser.h" // ----------------------------------------------------------------------------- class MADDY_PARAGRAPHPARSER : public ::testing::Test { protected: std::shared_ptr pParser; void SetUp() override { this->pParser = std::make_shared( 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 markdown = { "Some text" , "and some other text" , "" }; std::string expected = "

Some text and some other text

"; 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); }