From 93843bd2fe8c91fe9e659c5b801f1a7d672dc223 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 10 Jan 2016 23:35:33 -0800 Subject: Added cmark_node_replace(oldnode, newnode). API change. I've found in using the API that this is very often wanted. --- api_test/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'api_test/main.c') diff --git a/api_test/main.c b/api_test/main.c index 9fe96f2..9d3bf84 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -359,10 +359,17 @@ static void create_tree(test_batch_runner *runner) { // 1e3 OK(runner, cmark_node_previous(emph) == str1, "ins after2 works"); + cmark_node *str4 = cmark_node_new(CMARK_NODE_TEXT); + cmark_node_set_literal(str4, "brzz"); + OK(runner, cmark_node_replace(str1, str4), "replace"); + INT_EQ(runner, cmark_node_check(doc, NULL), 0, "replace consistent"); + OK(runner, cmark_node_previous(emph) == str4, "replace works"); + INT_EQ(runner, cmark_node_replace(p, str4), 0, "replace str for p fails"); + cmark_node_unlink(emph); html = cmark_render_html(doc, CMARK_OPT_DEFAULT); - STR_EQ(runner, html, "

Hello, !

\n", "render_html after shuffling"); + STR_EQ(runner, html, "

brzz!

\n", "render_html after shuffling"); free(html); cmark_node_free(doc); -- cgit v1.2.3