@@ -952,27 +952,51 @@ static void source_pos(test_batch_runner *runner) {
952
952
cmark_node_free (doc );
953
953
}
954
954
955
- static void source_pos_2 (test_batch_runner * runner ) {
956
- static const char markdown [] =
957
- "*first*\n"
958
- "second\n" ;
959
-
960
- cmark_node * doc = cmark_parse_document (markdown , sizeof (markdown ) - 1 , CMARK_OPT_DEFAULT );
961
- char * xml = cmark_render_xml (doc , CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS );
962
- STR_EQ (runner , xml , "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
963
- "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
964
- "<document sourcepos=\"1:1-2:6\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
965
- " <paragraph sourcepos=\"1:1-2:6\">\n"
966
- " <emph sourcepos=\"1:1-1:7\">\n"
967
- " <text sourcepos=\"1:2-1:6\" xml:space=\"preserve\">first</text>\n"
968
- " </emph>\n"
969
- " <softbreak />\n"
970
- " <text sourcepos=\"2:1-2:6\" xml:space=\"preserve\">second</text>\n"
971
- " </paragraph>\n"
972
- "</document>\n" ,
973
- "sourcepos are as expected" );
974
- free (xml );
975
- cmark_node_free (doc );
955
+ static void source_pos_inlines (test_batch_runner * runner ) {
956
+ {
957
+ static const char markdown [] =
958
+ "*first*\n"
959
+ "second\n" ;
960
+
961
+ cmark_node * doc = cmark_parse_document (markdown , sizeof (markdown ) - 1 , CMARK_OPT_DEFAULT );
962
+ char * xml = cmark_render_xml (doc , CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS );
963
+ STR_EQ (runner , xml , "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
964
+ "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
965
+ "<document sourcepos=\"1:1-2:6\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
966
+ " <paragraph sourcepos=\"1:1-2:6\">\n"
967
+ " <emph sourcepos=\"1:1-1:7\">\n"
968
+ " <text sourcepos=\"1:2-1:6\" xml:space=\"preserve\">first</text>\n"
969
+ " </emph>\n"
970
+ " <softbreak />\n"
971
+ " <text sourcepos=\"2:1-2:6\" xml:space=\"preserve\">second</text>\n"
972
+ " </paragraph>\n"
973
+ "</document>\n" ,
974
+ "sourcepos are as expected" );
975
+ free (xml );
976
+ cmark_node_free (doc );
977
+ }
978
+ {
979
+ static const char markdown [] =
980
+ "*first\n"
981
+ "second*\n" ;
982
+
983
+ cmark_node * doc = cmark_parse_document (markdown , sizeof (markdown ) - 1 , CMARK_OPT_DEFAULT );
984
+ char * xml = cmark_render_xml (doc , CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS );
985
+ STR_EQ (runner , xml , "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
986
+ "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
987
+ "<document sourcepos=\"1:1-2:7\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
988
+ " <paragraph sourcepos=\"1:1-2:7\">\n"
989
+ " <emph sourcepos=\"1:1-2:7\">\n"
990
+ " <text sourcepos=\"1:2-1:6\" xml:space=\"preserve\">first</text>\n"
991
+ " <softbreak />\n"
992
+ " <text sourcepos=\"2:1-2:6\" xml:space=\"preserve\">second</text>\n"
993
+ " </emph>\n"
994
+ " </paragraph>\n"
995
+ "</document>\n" ,
996
+ "sourcepos are as expected" );
997
+ free (xml );
998
+ cmark_node_free (doc );
999
+ }
976
1000
}
977
1001
978
1002
static void ref_source_pos (test_batch_runner * runner ) {
@@ -1025,7 +1049,7 @@ int main() {
1025
1049
test_safe (runner );
1026
1050
test_feed_across_line_ending (runner );
1027
1051
source_pos (runner );
1028
- source_pos_2 (runner );
1052
+ source_pos_inlines (runner );
1029
1053
ref_source_pos (runner );
1030
1054
1031
1055
test_print_summary (runner );
0 commit comments