stuff-from-scratch/test/web/TestMarkdownParser.cpp
2022-12-01 17:13:54 +00:00

29 lines
726 B
C++

#include "MarkdownParser.h"
#include "File.h"
#include "HtmlDocument.h"
#include "MarkdownDocument.h"
#include "MarkdownConverter.h"
#include "HtmlWriter.h"
#include "TestFramework.h"
#include "TestUtils.h"
TEST_CASE(TestMarkdownParser, "web")
{
File md_file(TestUtils::getTestDataDir() / "sample_markdown.md");
const auto md_content = md_file.readText();
MarkdownParser parser;
auto md_doc = parser.run(md_content);
MarkdownConverter converter;
auto html = converter.convert(md_doc.get());
HtmlWriter writer;
const auto html_string = writer.toString(html.get());
File html_file(TestUtils::getTestOutputDir() / "TestMarkdownParserOut.html");
html_file.writeText(html_string);
}