aboutsummaryrefslogtreecommitdiff
path: root/api_test
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-23 14:00:00 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-23 14:00:00 +0100
commitf2e6aaf9b9c3a5108b1d89d6c70a6ae93cecf690 (patch)
tree5bb69d58c93d70e46c4262a1be7e7beb60f048f1 /api_test
parent4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24 (diff)
Fix segfault on docs without trailing newline
Diffstat (limited to 'api_test')
-rw-r--r--api_test/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c
index 4ee3546..085d458 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -441,6 +441,18 @@ test_content(test_batch_runner *runner, cmark_node_type type,
}
static void
+parser(test_batch_runner *runner)
+{
+ static const char markdown[] = "No newline";
+ cmark_node *doc = cmark_parse_document(markdown, sizeof(markdown) - 1);
+ char *html = cmark_render_html(doc);
+ STR_EQ(runner, html, "<p>No newline</p>\n",
+ "document without trailing newline");
+ free(html);
+ cmark_node_destroy(doc);
+}
+
+static void
render_html(test_batch_runner *runner)
{
char *html;
@@ -479,6 +491,7 @@ int main() {
node_check(runner);
create_tree(runner);
hierarchy(runner);
+ parser(runner);
render_html(runner);
test_print_summary(runner);