summaryrefslogtreecommitdiff
path: root/api_test/main.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-08-08 13:10:10 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-08-08 13:10:47 -0700
commita4f61e832fa9f99e04d05ab4b4768538ba076c84 (patch)
tree37c52839620de5198487327e2fdfa5823b9c38af /api_test/main.c
parent2c3612447e35c879ad99e637dd473ec58fde9fd0 (diff)
Treat line ending with EOF as ending with newline.
Closes #71. Added a test to api_test.
Diffstat (limited to 'api_test/main.c')
-rw-r--r--api_test/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c
index 7c3ac1d..bcfbb6d 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -677,6 +677,7 @@ line_endings(test_batch_runner *runner)
STR_EQ(runner, html, "<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d</li>\n</ul>\n",
"list with different line endings");
free(html);
+
static const char crlf_lines[] = "line\r\nline\r\n";
html = cmark_markdown_to_html(crlf_lines,
sizeof(crlf_lines) - 1,
@@ -684,6 +685,14 @@ line_endings(test_batch_runner *runner)
STR_EQ(runner, html, "<p>line<br />\nline</p>\n",
"crlf endings with CMARK_OPT_HARDBREAKS");
free(html);
+
+ static const char no_line_ending[] = "```\nline\n```";
+ html = cmark_markdown_to_html(no_line_ending,
+ sizeof(no_line_ending) - 1,
+ CMARK_OPT_DEFAULT);
+ STR_EQ(runner, html, "<pre><code>line\n</code></pre>\n",
+ "fenced code block with no final newline");
+ free(html);
}
static void