Branch Coverage

include/eshu_xml.h
Criterion Covered Total %
branch 204 270 75.5


line true false branch
50 393 27 for (i = 0; i < plen; i++) {
51 0 393 if (!str[i]) return 0;
52 111 282 if (tolower((unsigned char)str[i]) != tolower((unsigned char)prefix[i]))
66 0 242 if (!isalpha((unsigned char)*p)) return 0;
67 903 242 while (isalnum((unsigned char)p[n]) || p[n] == ':' || p[n] == '_' || p[n] == '-')
0 242 while (isalnum((unsigned char)p[n]) || p[n] == ':' || p[n] == '_' || p[n] == '-')
0 242 while (isalnum((unsigned char)p[n]) || p[n] == ':' || p[n] == '_' || p[n] == '-')
0 242 while (isalnum((unsigned char)p[n]) || p[n] == ':' || p[n] == '_' || p[n] == '-')
83 836 55 for (i = 0; eshu_html_void_elements[i]; i++) {
86 184 652 if (ve_len == name_len) {
88 229 10 for (j = 0; j < name_len; j++) {
89 174 55 if (tolower((unsigned char)name[j]) != ve[j]) {
94 10 174 if (match) return 1;
110 182 52 for (i = 0; eshu_html_verbatim_elements[i]; i++) {
113 21 161 if (ve_len == name_len) {
115 79 13 for (j = 0; j < name_len; j++) {
116 8 71 if (tolower((unsigned char)name[j]) != ve[j]) {
121 13 8 if (match) return 1;
134 370 31 while (p < eol) {
135 15 355 if (p[0] == '<' && p[1] == '/') {
13 2 if (p[0] == '<' && p[1] == '/') {
137 13 0 if (eshu_xml_ci_prefix(p, eshu_xml_verbatim_tag,
140 13 0 while (after < eol && (*after == ' ' || *after == '\t'))
0 13 while (after < eol && (*after == ' ' || *after == '\t'))
0 13 while (after < eol && (*after == ' ' || *after == '\t'))
142 13 0 if (after < eol && *after == '>')
13 0 if (after < eol && *after == '>')
171 6 222 if (ctx->in_tag) {
172 79 3 while (p < eol) {
173 36 43 if (ctx->state == ESHU_XML_ATTR_DQ) {
174 6 30 if (*p == '"') ctx->state = ESHU_XML_TAG;
178 0 43 if (ctx->state == ESHU_XML_ATTR_SQ) {
179 0 0 if (*p == '\'') ctx->state = ESHU_XML_TAG;
183 6 37 if (*p == '"') {
188 0 37 if (*p == '\'') {
193 35 2 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
1 34 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
1 0 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
200 2 34 if (*p == '>') {
203 2 0 if (!ctx->tag_is_close) {
212 3 3 if (ctx->in_tag) return; /* still inside tag */
215 601 209 while (p < eol) {
217 67 534 if (ctx->state == ESHU_XML_COMMENT) {
218 63 4 if (p + 2 < eol && p[0] == '-' && p[1] == '-' && p[2] == '>') {
4 59 if (p + 2 < eol && p[0] == '-' && p[1] == '-' && p[2] == '>') {
4 0 if (p + 2 < eol && p[0] == '-' && p[1] == '-' && p[2] == '>') {
4 0 if (p + 2 < eol && p[0] == '-' && p[1] == '-' && p[2] == '>') {
228 47 487 if (ctx->state == ESHU_XML_CDATA) {
229 43 4 if (p + 2 < eol && p[0] == ']' && p[1] == ']' && p[2] == '>') {
3 40 if (p + 2 < eol && p[0] == ']' && p[1] == ']' && p[2] == '>') {
3 0 if (p + 2 < eol && p[0] == ']' && p[1] == ']' && p[2] == '>') {
3 0 if (p + 2 < eol && p[0] == ']' && p[1] == ']' && p[2] == '>') {
239 53 434 if (ctx->state == ESHU_XML_PI) {
240 53 0 if (p + 1 < eol && p[0] == '?' && p[1] == '>') {
2 51 if (p + 1 < eol && p[0] == '?' && p[1] == '>') {
2 0 if (p + 1 < eol && p[0] == '?' && p[1] == '>') {
250 12 422 if (ctx->state == ESHU_XML_DOCTYPE) {
251 2 10 if (*p == '>') {
261 169 253 if (*p != '<') {
268 249 4 if (p + 3 < eol && p[1] == '!' && p[2] == '-' && p[3] == '-') {
9 240 if (p + 3 < eol && p[1] == '!' && p[2] == '-' && p[3] == '-') {
4 5 if (p + 3 < eol && p[1] == '!' && p[2] == '-' && p[3] == '-') {
4 0 if (p + 3 < eol && p[1] == '!' && p[2] == '-' && p[3] == '-') {
275 61 188 if (p + 8 < eol && eshu_xml_ci_prefix(p, "
3 58 if (p + 8 < eol && eshu_xml_ci_prefix(p, "
282 55 191 if (p + 9 < eol && eshu_xml_ci_prefix(p, "
2 53 if (p + 9 < eol && eshu_xml_ci_prefix(p, "
289 244 0 if (p + 1 < eol && p[1] == '?') {
2 242 if (p + 1 < eol && p[1] == '?') {
296 242 0 if (p + 1 < eol && p[1] == '/') {
105 137 if (p + 1 < eol && p[1] == '/') {
299 105 0 if (nlen > 0) {
302 105 0 while (p < eol && *p != '>') p++;
0 105 while (p < eol && *p != '>') p++;
303 105 0 if (p < eol) p++; /* skip > */
315 137 0 if (nlen > 0) {
317 65 72 int is_void_el = is_html && eshu_xml_is_void(tag_start, nlen);
10 55 int is_void_el = is_html && eshu_xml_is_void(tag_start, nlen);
318 65 72 int is_verbatim_el = is_html && eshu_xml_is_verbatim(tag_start, nlen);
13 52 int is_verbatim_el = is_html && eshu_xml_is_verbatim(tag_start, nlen);
325 230 3 while (p < eol) {
326 13 217 if (*p == '"') {
328 79 0 while (p < eol && *p != '"') p++;
66 13 while (p < eol && *p != '"') p++;
329 13 0 if (p < eol) p++;
332 0 217 if (*p == '\'') {
334 0 0 while (p < eol && *p != '\'') p++;
0 0 while (p < eol && *p != '\'') p++;
335 0 0 if (p < eol) p++;
338 124 93 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
7 117 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
7 0 if (p + 1 < eol && p[0] == '/' && p[1] == '>') {
344 127 83 if (*p == '>') {
352 3 134 if (!tag_complete) {
361 127 7 if (!self_closing && !is_void_el) {
117 10 if (!self_closing && !is_void_el) {
362 13 104 if (is_verbatim_el) {
372 13 0 if (is_html && nlen == 6 &&
397 216 0 if (content < eol && content[0] == '<' && content + 1 < eol && content[1] == '/') {
214 2 if (content < eol && content[0] == '<' && content + 1 < eol && content[1] == '/') {
214 0 if (content < eol && content[0] == '<' && content + 1 < eol && content[1] == '/') {
71 143 if (content < eol && content[0] == '<' && content + 1 < eol && content[1] == '/') {
408 0 0 if (ctx->in_tag) {
425 272 2 int is_blank = (content == eol || *content == '\n');
0 272 int is_blank = (content == eol || *content == '\n');
428 44 230 if (ctx->state == ESHU_XML_VERBATIM) {
429 13 31 if (eshu_xml_verbatim_end(content, eol)) {
431 9 4 if (ctx->in_script && ctx->script_buf.data) {
9 0 if (ctx->in_script && ctx->script_buf.data) {
453 24 9 while (jp < je) {
456 24 0 if (jc < jnl) {
462 24 0 jp = (*jnl == '\n') ? jnl + 1 : jnl;
463 0 24 if (jp > je) jp = je;
473 0 13 if (ctx->depth < 0) ctx->depth = 0;
477 13 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
478 24 7 } else if (ctx->in_script) {
485 7 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
491 2 228 if (is_blank) {
492 2 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
497 225 3 if (ctx->state == ESHU_XML_COMMENT || ctx->state == ESHU_XML_CDATA ||
222 3 if (ctx->state == ESHU_XML_COMMENT || ctx->state == ESHU_XML_CDATA ||
498 222 0 ctx->state == ESHU_XML_PI || ctx->state == ESHU_XML_DOCTYPE) {
0 222 ctx->state == ESHU_XML_PI || ctx->state == ESHU_XML_DOCTYPE) {
502 6 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
505 0 6 if (ctx->depth < 0) ctx->depth = 0;
510 6 216 if (ctx->in_tag) {
514 6 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
517 0 6 if (ctx->depth < 0) ctx->depth = 0;
531 216 0 if (*eol == '\n') eshu_buf_putc(out, '\n');
539 71 145 if (line_pre == -1) {
544 0 216 if (ctx->depth < 0) ctx->depth = 0;
563 274 43 while (p < end) {
566 274 0 p = (*eol == '\n') ? eol + 1 : eol;
567 0 274 if (p > end) p = end;
571 0 43 if (ctx.script_buf.data)