/* * This project is licensed under the MIT license. For more information see the * LICENSE file. */ #include #include "gmock/gmock.h" #include "maddy/imageparser.h" // ----------------------------------------------------------------------------- TEST(MADDY_IMAGEPARSER, ItReplacesMarkdownWithAnImage) { std::string text = "Some text ![Image Title](http://example.com/a.png)"; std::string expected = "Some text \"Image"; auto imageParser = std::make_shared(); imageParser->Parse(text); ASSERT_EQ(expected, text); } TEST(MADDY_IMAGEPARSER, ItReplacesMarkdownWithImages) { std::string text = "Some text ![Image Title](http://example.com/a.png) bla ![Image Title](http://example.com/a.png)"; std::string expected = "Some text \"Image bla \"Image"; auto imageParser = std::make_shared(); imageParser->Parse(text); ASSERT_EQ(expected, text); } TEST(MADDY_IMAGEPARSER, ItReplacesNoLinkMarkdownWithImages) { std::string text = "Some text [Image Title](http://example.com)"; std::string expected(text); auto imageParser = std::make_shared(); imageParser->Parse(text); ASSERT_EQ(expected, text); }