summaryrefslogtreecommitdiff
path: root/api_test
diff options
context:
space:
mode:
authorAshe Connor <ashe@kivikakk.ee>2018-11-12 15:44:11 +1100
committerAshe Connor <ashe@kivikakk.ee>2018-11-12 16:09:46 +1100
commit462cab48390ba73123a2f882f43d6e0bc4d0053c (patch)
treea9aeffb3c41d7a9255aab73b4f1b90f0d4f66cf6 /api_test
parent3a440af3ba874289ef33ac6bbf2da90040c123d6 (diff)
add failing test
Diffstat (limited to 'api_test')
-rw-r--r--api_test/main.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c
index a843530..286e9d5 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -952,6 +952,29 @@ static void source_pos(test_batch_runner *runner) {
cmark_node_free(doc);
}
+static void source_pos_2(test_batch_runner *runner) {
+ static const char markdown[] =
+ "*first*\n"
+ "second\n";
+
+ cmark_node *doc = cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT);
+ char *xml = cmark_render_xml(doc, CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS);
+ STR_EQ(runner, xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
+ "<document sourcepos=\"1:1-2:6\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
+ " <paragraph sourcepos=\"1:1-2:6\">\n"
+ " <emph sourcepos=\"1:1-1:7\">\n"
+ " <text sourcepos=\"1:2-1:6\" xml:space=\"preserve\">first</text>\n"
+ " </emph>\n"
+ " <softbreak />\n"
+ " <text sourcepos=\"2:1-2:6\" xml:space=\"preserve\">second</text>\n"
+ " </paragraph>\n"
+ "</document>\n",
+ "sourcepos are as expected");
+ free(xml);
+ cmark_node_free(doc);
+}
+
static void ref_source_pos(test_batch_runner *runner) {
static const char markdown[] =
"Let's try [reference] links.\n"
@@ -1002,6 +1025,7 @@ int main() {
test_safe(runner);
test_feed_across_line_ending(runner);
source_pos(runner);
+ source_pos_2(runner);
ref_source_pos(runner);
test_print_summary(runner);