summaryrefslogtreecommitdiff
path: root/api_test
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-01-10 23:35:33 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-01-10 23:35:33 -0800
commit93843bd2fe8c91fe9e659c5b801f1a7d672dc223 (patch)
tree1b3af3c5fb8c4e7abc8491efd3570620eb4d8d91 /api_test
parente384149e683fd6ea950ba9318525563175ca9f47 (diff)
Added cmark_node_replace(oldnode, newnode).
API change. I've found in using the API that this is very often wanted.
Diffstat (limited to 'api_test')
-rw-r--r--api_test/main.c9
1 files changed, 8 insertions, 1 deletions
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, "<p>Hello, !</p>\n", "render_html after shuffling");
+ STR_EQ(runner, html, "<p>brzz!</p>\n", "render_html after shuffling");
free(html);
cmark_node_free(doc);