diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 16:35:54 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 16:35:54 -0800 |
commit | ccc13fd3a007b92c3944af39a3834fa7d33bfe58 (patch) | |
tree | eb3cadd7849dccefd716032a36230bfe6ca69575 /api_test/main.c | |
parent | a980839495224bda5d28c167acd8c219771aa8c3 (diff) |
Added commonmark renderer test (currently failing).
Diffstat (limited to 'api_test/main.c')
-rw-r--r-- | api_test/main.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c index e8e791c..51c4292 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -598,6 +598,43 @@ static void render_latex(test_batch_runner *runner) { cmark_node_free(doc); } +static void render_commonmark(test_batch_runner *runner) { + char *commonmark; + + static const char markdown[] = "\\- foo *bar* \\*bar\\*\n" + "\n" + "- Lorem ipsum dolor sit - amet,\n" + " consectetur adipiscing elit,\n" + "- sed do eiusmod tempor incididunt\n" + " ut labore et dolore magna aliqua.\n"; + cmark_node *doc = + cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT); + + commonmark = cmark_render_commonmark(doc, CMARK_OPT_DEFAULT, 24); + STR_EQ(runner, commonmark, + "\\- foo *bar* \\*bar\\*\n" + "\n" + "* Lorem ipsum dolor sit\n" + " \\- amet, consectetur\n" + " adipiscing elit,\n" + "* sed do eiusmod tempor\n" + " incididunt ut labore\n" + " et dolore magna\n" + " aliqua.\n", + "render document with wrapping"); + free(commonmark); + commonmark = cmark_render_commonmark(doc, CMARK_OPT_DEFAULT, 0); + STR_EQ(runner, commonmark, "\\- foo *bar* \\*bar\\*\n" + "\n" + "* Lorem ipsum dolor sit - amet,\n" + " consectetur adipiscing elit,\n" + "* sed do eiusmod tempor incididunt\n" + " ut labore et dolore magna aliqua.\n", + "render document without wrapping"); + free(commonmark); + cmark_node_free(doc); +} + static void utf8(test_batch_runner *runner) { // Ranges test_char(runner, 1, "\x01", "valid utf8 01"); @@ -782,6 +819,7 @@ int main() { render_html(runner); render_man(runner); render_latex(runner); + render_commonmark(runner); utf8(runner); line_endings(runner); numeric_entities(runner); |