cmark

My personal build of CMark ✏️

Commit
7cb92c313c31fc808dded8f476f956447e912fe3
Parent
471907a36c8473abe6117bf5ac8902d94c367291
Author
John MacFarlane <jgm@berkeley.edu>
Date

Added api_test for #117.

Diffstat

1 file changed, 12 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified api_test/main.c 12 12 0
diff --git a/api_test/main.c b/api_test/main.c
@@ -852,6 +852,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();
@@ -876,6 +887,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;