summaryrefslogtreecommitdiff
path: root/api_test
diff options
context:
space:
mode:
Diffstat (limited to 'api_test')
-rw-r--r--api_test/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c
index bde6222..8da9ba9 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -362,6 +362,9 @@ static void create_tree(test_batch_runner *runner) {
cmark_node *str4 = cmark_node_new(CMARK_NODE_TEXT);
cmark_node_set_literal(str4, "brzz");
OK(runner, cmark_node_replace(str1, str4), "replace");
+ // The replaced node is not freed
+ cmark_node_free(str1);
+
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");
@@ -857,6 +860,17 @@ static void test_md_to_html(test_batch_runner *runner, const char *markdown,
free(html);
}
+static void test_feed_across_line_ending(test_batch_runner *runner) {
+ // See #117
+ cmark_parser *parser = cmark_parser_new(CMARK_OPT_DEFAULT);
+ cmark_parser_feed(parser, "line1\r", 6);
+ cmark_parser_feed(parser, "\nline2\r\n", 8);
+ cmark_node *document = cmark_parser_finish(parser);
+ OK(runner, document->first_child->next == NULL, "document has one paragraph");
+ cmark_parser_free(parser);
+ cmark_node_free(document);
+}
+
int main() {
int retval;
test_batch_runner *runner = test_batch_runner_new();
@@ -881,6 +895,7 @@ int main() {
numeric_entities(runner);
test_cplusplus(runner);
test_safe(runner);
+ test_feed_across_line_ending(runner);
test_print_summary(runner);
retval = test_ok(runner) ? 0 : 1;