2022-01-01 18:46:31 +00:00
|
|
|
#include "MarkdownParser.h"
|
2022-12-01 17:13:54 +00:00
|
|
|
|
2022-01-01 18:46:31 +00:00
|
|
|
#include "File.h"
|
2022-12-01 17:13:54 +00:00
|
|
|
|
|
|
|
#include "HtmlDocument.h"
|
|
|
|
#include "MarkdownDocument.h"
|
|
|
|
#include "MarkdownConverter.h"
|
2022-01-01 18:46:31 +00:00
|
|
|
#include "HtmlWriter.h"
|
|
|
|
|
2022-11-29 18:00:19 +00:00
|
|
|
#include "TestFramework.h"
|
2022-12-01 10:52:48 +00:00
|
|
|
#include "TestUtils.h"
|
2022-11-29 18:00:19 +00:00
|
|
|
|
|
|
|
TEST_CASE(TestMarkdownParser, "web")
|
2022-01-01 18:46:31 +00:00
|
|
|
{
|
2022-12-01 10:52:48 +00:00
|
|
|
File md_file(TestUtils::getTestDataDir() / "sample_markdown.md");
|
|
|
|
const auto md_content = md_file.readText();
|
2022-01-01 18:46:31 +00:00
|
|
|
|
|
|
|
MarkdownParser parser;
|
2022-12-01 17:13:54 +00:00
|
|
|
auto md_doc = parser.run(md_content);
|
2022-01-01 18:46:31 +00:00
|
|
|
|
2022-12-01 17:13:54 +00:00
|
|
|
MarkdownConverter converter;
|
|
|
|
auto html = converter.convert(md_doc.get());
|
2022-01-01 18:46:31 +00:00
|
|
|
|
|
|
|
HtmlWriter writer;
|
2022-12-01 11:49:57 +00:00
|
|
|
const auto html_string = writer.toString(html.get());
|
2022-01-01 18:46:31 +00:00
|
|
|
|
2022-12-01 10:52:48 +00:00
|
|
|
File html_file(TestUtils::getTestOutputDir() / "TestMarkdownParserOut.html");
|
|
|
|
html_file.writeText(html_string);
|
2022-01-01 18:46:31 +00:00
|
|
|
}
|