Branch Coverage

include/eshu_pl.h
Criterion Covered Total %
branch 306 412 74.2


line true false branch
86 22 6 return c == '(' || c == '{' || c == '[' || c == '<';
7 15 return c == '(' || c == '{' || c == '[' || c == '<';
6 1 return c == '(' || c == '{' || c == '[' || c == '<';
1 5 return c == '(' || c == '{' || c == '[' || c == '<';
104 19 0 if (p + 1 >= end || *(p + 1) != '<')
7 12 if (p + 1 >= end || *(p + 1) != '<')
109 12 0 if (p < end && *p == '~') {
1 11 if (p < end && *p == '~') {
115 12 0 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
7 5 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
6 1 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
0 6 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
122 60 0 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
48 12 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
0 12 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
125 12 0 if (len == 0 || len >= ESHU_PL_HEREDOC_MAX)
0 12 if (len == 0 || len >= ESHU_PL_HEREDOC_MAX)
129 6 6 if (quote && (p >= end || *p != quote))
6 0 if (quote && (p >= end || *p != quote))
0 6 if (quote && (p >= end || *p != quote))
151 3 42 if (ctx->heredoc_indented) {
152 15 0 while (p < eol && (*p == ' ' || *p == '\t'))
12 3 while (p < eol && (*p == ' ' || *p == '\t'))
0 3 while (p < eol && (*p == ' ' || *p == '\t'))
159 0 45 if (len < ctx->heredoc_tag_len)
162 33 12 if (memcmp(p, ctx->heredoc_tag, ctx->heredoc_tag_len) != 0)
167 0 12 while (p < eol) {
168 0 0 if (*p != ' ' && *p != '\t' && *p != ';')
0 0 if (*p != ' ' && *p != '\t' && *p != ';')
0 0 if (*p != ' ' && *p != '\t' && *p != ';')
180 736 26 if (*content != '=')
183 26 0 if (content + 1 >= eol || !isalpha((unsigned char)content[1]))
0 26 if (content + 1 >= eol || !isalpha((unsigned char)content[1]))
186 26 0 if (eol - content >= 4 && memcmp(content, "=cut", 4) == 0)
0 26 if (eol - content >= 4 && memcmp(content, "=cut", 4) == 0)
193 13 552 if (len < 4) return 0;
194 528 24 if (memcmp(content, "=cut", 4) != 0) return 0;
196 0 24 if (len > 4 && content[4] != ' ' && content[4] != '\t')
0 0 if (len > 4 && content[4] != ' ' && content[4] != '\t')
0 0 if (len > 4 && content[4] != ' ' && content[4] != '\t')
226 23 5 if (eshu_pl_is_paired(delim)) {
251 13 499 if (c == 'q') {
253 13 0 if (p < end && *(p) == 'w') {
9 4 if (p < end && *(p) == 'w') {
255 4 0 } else if (p < end && *(p) == 'q') {
1 3 } else if (p < end && *(p) == 'q') {
257 3 0 } else if (p < end && *(p) == 'x') {
0 3 } else if (p < end && *(p) == 'x') {
259 3 0 } else if (p < end && *(p) == 'r') {
2 1 } else if (p < end && *(p) == 'r') {
264 243 256 } else if (c == 's') {
268 1 255 } else if (c == 't' && p + 1 < end && *(p + 1) == 'r') {
1 0 } else if (c == 't' && p + 1 < end && *(p + 1) == 'r') {
1 0 } else if (c == 't' && p + 1 < end && *(p + 1) == 'r') {
272 3 252 } else if (c == 'y') {
276 252 0 } else if (c == 'm') {
284 0 512 if (p >= end)
286 25 487 if (isalnum((unsigned char)*p) || *p == '_')
0 25 if (isalnum((unsigned char)*p) || *p == '_')
288 23 2 if (*p == ' ' || *p == '\t' || *p == '\n')
23 0 if (*p == ' ' || *p == '\t' || *p == '\n')
0 23 if (*p == ' ' || *p == '\t' || *p == '\n')
299 362 379 if (p <= line_start)
301 150 229 return isalnum((unsigned char)*(p - 1)) || *(p - 1) == '_';
0 150 return isalnum((unsigned char)*(p - 1)) || *(p - 1) == '_';
315 8687 1039 while (p < end) {
320 7269 462 if (c == '{' || c == '(' || c == '[') {
7100 169 if (c == '{' || c == '(' || c == '[') {
35 7065 if (c == '{' || c == '(' || c == '[') {
323 6601 464 } else if (c == '}' || c == ')' || c == ']') {
6434 167 } else if (c == '}' || c == ')' || c == ']') {
35 6399 } else if (c == '}' || c == ')' || c == ']') {
325 0 666 if (ctx->depth < 0) ctx->depth = 0;
327 26 6373 } else if (c == '"') {
330 49 6324 } else if (c == '\'') {
333 24 6300 } else if (c == '#') {
337 19 6281 } else if (c == '<' && eshu_pl_detect_heredoc(ctx, p, end)) {
12 7 } else if (c == '<' && eshu_pl_detect_heredoc(ctx, p, end)) {
341 12 0 if (p < end && *p == '~') p++;
1 11 if (p < end && *p == '~') p++;
342 12 0 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
7 5 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
6 1 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
0 6 if (p < end && (*p == '\'' || *p == '"' || *p == '`')) {
344 28 0 while (p < end && *p != hq) p++;
22 6 while (p < end && *p != hq) p++;
345 6 0 if (p < end) p++;
347 32 0 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
26 6 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
0 6 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
352 19 6269 } else if (c == '/' && eshu_pl_expects_regex(ctx)) {
4 15 } else if (c == '/' && eshu_pl_expects_regex(ctx)) {
354 4 0 if (p + 1 < end && *(p + 1) == '/') {
0 4 if (p + 1 < end && *(p + 1) == '/') {
357 0 0 if (p < end && *p == '=') p++; /* //= */
0 0 if (p < end && *p == '=') p++; /* //= */
365 6271 13 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
6019 252 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
5776 243 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
5556 220 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
53 5503 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
366 53 0 (c == 't' && p + 1 < end && *(p + 1) == 'r')) &&
369 23 489 if (consumed > 0) {
375 489 0 if (isalnum((unsigned char)c))
377 15 5757 } else if (c == '/' && !eshu_pl_expects_regex(ctx)) {
15 0 } else if (c == '/' && !eshu_pl_expects_regex(ctx)) {
379 15 0 if (p + 1 < end && *(p + 1) == '/') {
11 4 if (p + 1 < end && *(p + 1) == '/') {
381 11 0 if (p < end && *p == '=') p++; /* //= */
8 3 if (p < end && *p == '=') p++; /* //= */
386 5129 628 } else if (c == '$' || c == '@' || c == '%') {
5028 101 } else if (c == '$' || c == '@' || c == '%') {
35 4993 } else if (c == '$' || c == '@' || c == '%') {
390 3365 0 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
2521 844 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
80 764 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
0 764 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
393 169 4824 } else if (isdigit((unsigned char)c)) {
395 388 0 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
213 175 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
6 169 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
0 169 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
398 308 4516 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
308 0 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
15 293 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
403 0 4809 } else if (c == '!' && p + 1 < end && *(p + 1) == '~') {
0 0 } else if (c == '!' && p + 1 < end && *(p + 1) == '~') {
0 0 } else if (c == '!' && p + 1 < end && *(p + 1) == '~') {
407 2745 2064 } else if (c == ' ' || c == '\t') {
2745 0 } else if (c == ' ' || c == '\t') {
409 1553 1192 } else if (isalpha((unsigned char)c) || c == '_') {
27 1526 } else if (isalpha((unsigned char)c) || c == '_') {
412 5942 0 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
4626 1316 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
97 1219 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
424 19 237 if (c == '\\' && p + 1 < end) {
19 0 if (c == '\\' && p + 1 < end) {
426 26 211 } else if (c == '"') {
433 1 299 if (c == '\\' && p + 1 < end) {
1 0 if (c == '\\' && p + 1 < end) {
435 49 250 } else if (c == '\'') {
442 3 24 if (c == '\\' && p + 1 < end) {
3 0 if (c == '\\' && p + 1 < end) {
444 4 20 } else if (c == ctx->rx_delim) {
449 4 0 while (p < end && isalpha((unsigned char)*p))
0 4 while (p < end && isalpha((unsigned char)*p))
458 4 369 if (c == '\\' && p + 1 < end && ctx->state != ESHU_QW) {
4 0 if (c == '\\' && p + 1 < end && ctx->state != ESHU_QW) {
4 0 if (c == '\\' && p + 1 < end && ctx->state != ESHU_QW) {
460 331 38 } else if (ctx->q_close != ctx->q_open) {
462 4 327 if (c == ctx->q_open) {
464 27 300 } else if (c == ctx->q_close) {
466 23 4 if (ctx->q_depth == 0) {
468 18 5 if (ctx->q_sections <= 0) {
473 27 0 while (p < end && isalpha((unsigned char)*p))
9 18 while (p < end && isalpha((unsigned char)*p))
480 5 0 while (p < end && (*p == ' ' || *p == '\t'))
0 5 while (p < end && (*p == ' ' || *p == '\t'))
0 5 while (p < end && (*p == ' ' || *p == '\t'))
482 5 0 if (p < end) {
493 9 29 if (c == ctx->q_close) {
495 5 4 if (ctx->q_sections <= 0) {
500 8 0 while (p < end && isalpha((unsigned char)*p))
3 5 while (p < end && isalpha((unsigned char)*p))
534 909 1307 if (ctx->state == ESHU_POD) {
535 565 344 if (content < eol && eshu_pl_is_pod_end(content, eol)) {
24 541 if (content < eol && eshu_pl_is_pod_end(content, eol)) {
537 24 0 if (ctx->pod_buf.len > 0) {
561 1265 42 if (ctx->state == ESHU_HEREDOC || ctx->state == ESHU_HEREDOC_INDENT) {
3 1262 if (ctx->state == ESHU_HEREDOC || ctx->state == ESHU_HEREDOC_INDENT) {
567 12 33 if (eshu_pl_is_heredoc_end(ctx, line_start, eol)) {
576 146 1116 if (content >= eol) {
584 23 1093 if (ctx->past_end) {
586 18 5 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
5 13 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
600 753 340 if (content == line_start &&
527 226 if (content == line_start &&
601 7 520 ((line_len >= 7 && memcmp(content, "__END__", 7) == 0 &&
0 7 ((line_len >= 7 && memcmp(content, "__END__", 7) == 0 &&
602 0 0 (line_len == 7 || content[7] == ' ' || content[7] == '\t' || content[7] == '\r')) ||
0 0 (line_len == 7 || content[7] == ' ' || content[7] == '\t' || content[7] == '\r')) ||
0 0 (line_len == 7 || content[7] == ' ' || content[7] == '\t' || content[7] == '\r')) ||
497 249 (line_len == 7 || content[7] == ' ' || content[7] == '\t' || content[7] == '\r')) ||
603 2 495 (line_len >= 8 && memcmp(content, "__DATA__", 8) == 0 &&
0 2 (line_len >= 8 && memcmp(content, "__DATA__", 8) == 0 &&
604 0 0 (line_len == 8 || content[8] == ' ' || content[8] == '\t' || content[8] == '\r')))) {
0 0 (line_len == 8 || content[8] == ' ' || content[8] == '\t' || content[8] == '\r')))) {
0 0 (line_len == 8 || content[8] == ' ' || content[8] == '\t' || content[8] == '\r')))) {
612 744 340 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
21 723 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
622 1051 12 if (ctx->state == ESHU_QW || ctx->state == ESHU_QQ ||
1041 10 if (ctx->state == ESHU_QW || ctx->state == ESHU_QQ ||
623 1041 0 ctx->state == ESHU_Q || ctx->state == ESHU_REGEX) {
0 1041 ctx->state == ESHU_Q || ctx->state == ESHU_REGEX) {
626 22 0 if (ctx->q_close && *content == ctx->q_close)
7 15 if (ctx->q_close && *content == ctx->q_close)
639 817 224 if (*content == '}' || *content == ')' || *content == ']') {
813 4 if (*content == '}' || *content == ')' || *content == ']') {
9 804 if (*content == '}' || *content == ')' || *content == ']') {
641 0 237 if (indent_depth < 0) indent_depth = 0;
652 12 1029 if (ctx->heredoc_pending) {
654 1 11 ctx->state = ctx->heredoc_indented ? ESHU_HEREDOC_INDENT : ESHU_HEREDOC;
675 2216 128 while (p < end) {
678 2213 3 if (eshu_in_range(cfg, line_num)) {
689 2216 0 if (*p == '\n') p++;
695 2 126 if (ctx.pod_buf.len > 0) {