From b8a916fbe14fa51abaeb325390a3a177a4561a71 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 19 Dec 2015 21:59:20 -0800 Subject: Added api_tests for custom nodes. --- api_test/main.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'api_test/main.c') diff --git a/api_test/main.c b/api_test/main.c index bcfbb6d..03a7b1b 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -445,6 +445,47 @@ create_tree(test_batch_runner *runner) cmark_node_free(emph); } +static void +custom_nodes(test_batch_runner *runner) +{ + char *html; + char *man; + cmark_node *doc = cmark_node_new(CMARK_NODE_DOCUMENT); + cmark_node *p = cmark_node_new(CMARK_NODE_PARAGRAPH); + cmark_node_append_child(doc, p); + cmark_node *ci = cmark_node_new(CMARK_NODE_CUSTOM_INLINE); + cmark_node *str1 = cmark_node_new(CMARK_NODE_TEXT); + cmark_node_set_literal(str1, "Hello"); + OK(runner, cmark_node_append_child(ci, str1), "append1"); + OK(runner, cmark_node_set_on_enter(ci, ""), + "set_on_exit"); + STR_EQ(runner, cmark_node_get_on_enter(ci), "", + "get_on_exit"); + cmark_node_append_child(p, ci); + cmark_node *cb = cmark_node_new(CMARK_NODE_CUSTOM_BLOCK); + cmark_node_set_on_enter(cb, "

\n\n