summaryrefslogtreecommitdiff
path: root/api_test/main.c
diff options
context:
space:
mode:
authorAshe Connor <ashe@kivikakk.ee>2018-11-13 11:06:47 +1100
committerAshe Connor <ashe@kivikakk.ee>2018-11-13 11:06:47 +1100
commitcfba1fc382c54c625eb7ccdfd38ba1c5caf1ca97 (patch)
treed1fd1ca595297ecb3a20f0c36e663c855a60215a /api_test/main.c
parent462cab48390ba73123a2f882f43d6e0bc4d0053c (diff)
expand tests
Diffstat (limited to 'api_test/main.c')
-rw-r--r--api_test/main.c68
1 files changed, 46 insertions, 22 deletions
diff --git a/api_test/main.c b/api_test/main.c
index 286e9d5..1f1f77f 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -952,27 +952,51 @@ 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 source_pos_inlines(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 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:7\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
+ " <paragraph sourcepos=\"1:1-2:7\">\n"
+ " <emph sourcepos=\"1:1-2:7\">\n"
+ " <text sourcepos=\"1:2-1:6\" xml:space=\"preserve\">first</text>\n"
+ " <softbreak />\n"
+ " <text sourcepos=\"2:1-2:6\" xml:space=\"preserve\">second</text>\n"
+ " </emph>\n"
+ " </paragraph>\n"
+ "</document>\n",
+ "sourcepos are as expected");
+ free(xml);
+ cmark_node_free(doc);
+ }
}
static void ref_source_pos(test_batch_runner *runner) {
@@ -1025,7 +1049,7 @@ int main() {
test_safe(runner);
test_feed_across_line_ending(runner);
source_pos(runner);
- source_pos_2(runner);
+ source_pos_inlines(runner);
ref_source_pos(runner);
test_print_summary(runner);