| 1131 | } |
| 1132 | |
| 1133 | static void ref_source_pos(test_batch_runner *runner) { |
| 1134 | static const char markdown[] = |
| 1135 | "Let's try [reference] links.\n" |
| 1136 | "\n" |
| 1137 | "[reference]: https://github.com (GitHub)\n"; |
| 1138 | |
| 1139 | cmark_node *doc = cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT); |
| 1140 | char *xml = cmark_render_xml(doc, CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS); |
| 1141 | STR_EQ(runner, xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1142 | "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n" |
| 1143 | "<document sourcepos=\"1:1-3:40\" xmlns=\"http://commonmark.org/xml/1.0\">\n" |
| 1144 | " <paragraph sourcepos=\"1:1-1:28\">\n" |
| 1145 | " <text sourcepos=\"1:1-1:10\" xml:space=\"preserve\">Let's try </text>\n" |
| 1146 | " <link sourcepos=\"1:11-1:21\" destination=\"https://github.com\" title=\"GitHub\">\n" |
| 1147 | " <text sourcepos=\"1:12-1:20\" xml:space=\"preserve\">reference</text>\n" |
| 1148 | " </link>\n" |
| 1149 | " <text sourcepos=\"1:22-1:28\" xml:space=\"preserve\"> links.</text>\n" |
| 1150 | " </paragraph>\n" |
| 1151 | "</document>\n", |
| 1152 | "sourcepos are as expected"); |
| 1153 | free(xml); |
| 1154 | cmark_node_free(doc); |
| 1155 | } |
| 1156 | |
| 1157 | int main(void) { |
| 1158 | int retval; |
no test coverage detected