Branch Coverage

include/eshu_pl.h
Criterion Covered Total %
branch 281 364 77.2


line true false branch
82 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 == '<';
100 17 0 if (p + 1 >= end || *(p + 1) != '<')
5 12 if (p + 1 >= end || *(p + 1) != '<')
105 12 0 if (p < end && *p == '~') {
1 11 if (p < end && *p == '~') {
111 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 == '`')) {
118 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 == '_'))
121 12 0 if (len == 0 || len >= ESHU_PL_HEREDOC_MAX)
0 12 if (len == 0 || len >= ESHU_PL_HEREDOC_MAX)
125 6 6 if (quote && (p >= end || *p != quote))
6 0 if (quote && (p >= end || *p != quote))
0 6 if (quote && (p >= end || *p != quote))
147 3 42 if (ctx->heredoc_indented) {
148 15 0 while (p < eol && (*p == ' ' || *p == '\t'))
12 3 while (p < eol && (*p == ' ' || *p == '\t'))
0 3 while (p < eol && (*p == ' ' || *p == '\t'))
155 0 45 if (len < ctx->heredoc_tag_len)
158 33 12 if (memcmp(p, ctx->heredoc_tag, ctx->heredoc_tag_len) != 0)
163 0 12 while (p < eol) {
164 0 0 if (*p != ' ' && *p != '\t' && *p != ';')
0 0 if (*p != ' ' && *p != '\t' && *p != ';')
0 0 if (*p != ' ' && *p != '\t' && *p != ';')
176 641 24 if (*content != '=')
179 24 0 if (content + 1 >= eol || !isalpha((unsigned char)content[1]))
0 24 if (content + 1 >= eol || !isalpha((unsigned char)content[1]))
182 24 0 if (eol - content >= 4 && memcmp(content, "=cut", 4) == 0)
0 24 if (eol - content >= 4 && memcmp(content, "=cut", 4) == 0)
189 13 545 if (len < 4) return 0;
190 523 22 if (memcmp(content, "=cut", 4) != 0) return 0;
192 0 22 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')
222 23 5 if (eshu_pl_is_paired(delim)) {
247 13 466 if (c == 'q') {
249 13 0 if (p < end && *(p) == 'w') {
9 4 if (p < end && *(p) == 'w') {
251 4 0 } else if (p < end && *(p) == 'q') {
1 3 } else if (p < end && *(p) == 'q') {
253 3 0 } else if (p < end && *(p) == 'x') {
0 3 } else if (p < end && *(p) == 'x') {
255 3 0 } else if (p < end && *(p) == 'r') {
2 1 } else if (p < end && *(p) == 'r') {
260 224 242 } else if (c == 's') {
264 1 241 } 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') {
268 3 238 } else if (c == 'y') {
272 238 0 } else if (c == 'm') {
280 0 479 if (p >= end)
282 25 454 if (isalnum((unsigned char)*p) || *p == '_')
0 25 if (isalnum((unsigned char)*p) || *p == '_')
284 23 2 if (*p == ' ' || *p == '\t' || *p == '\n')
23 0 if (*p == ' ' || *p == '\t' || *p == '\n')
0 23 if (*p == ' ' || *p == '\t' || *p == '\n')
295 335 357 if (p <= line_start)
297 144 213 return isalnum((unsigned char)*(p - 1)) || *(p - 1) == '_';
0 144 return isalnum((unsigned char)*(p - 1)) || *(p - 1) == '_';
311 8053 952 while (p < end) {
316 6712 431 if (c == '{' || c == '(' || c == '[') {
6555 157 if (c == '{' || c == '(' || c == '[') {
35 6520 if (c == '{' || c == '(' || c == '[') {
319 6087 433 } else if (c == '}' || c == ')' || c == ']') {
5932 155 } else if (c == '}' || c == ')' || c == ']') {
35 5897 } else if (c == '}' || c == ')' || c == ']') {
321 0 623 if (ctx->depth < 0) ctx->depth = 0;
323 22 5875 } else if (c == '"') {
326 47 5828 } else if (c == '\'') {
329 24 5804 } else if (c == '#') {
333 17 5787 } else if (c == '<' && eshu_pl_detect_heredoc(ctx, p, end)) {
12 5 } else if (c == '<' && eshu_pl_detect_heredoc(ctx, p, end)) {
337 12 0 if (p < end && *p == '~') p++;
1 11 if (p < end && *p == '~') p++;
338 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 == '`')) {
340 28 0 while (p < end && *p != hq) p++;
22 6 while (p < end && *p != hq) p++;
341 6 0 if (p < end) p++;
343 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 == '_'))
348 6 5786 } else if (c == '/' && eshu_pl_expects_regex(ctx)) {
3 3 } else if (c == '/' && eshu_pl_expects_regex(ctx)) {
353 5776 13 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
5538 238 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
5314 224 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
5108 206 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
47 5061 } else if ((c == 'q' || c == 'm' || c == 's' || c == 'y' ||
354 47 0 (c == 't' && p + 1 < end && *(p + 1) == 'r')) &&
357 23 456 if (consumed > 0) {
363 456 0 if (isalnum((unsigned char)c))
365 3 5307 } else if (c == '/' && !eshu_pl_expects_regex(ctx)) {
3 0 } else if (c == '/' && !eshu_pl_expects_regex(ctx)) {
368 4738 569 } else if (c == '$' || c == '@' || c == '%') {
4642 96 } else if (c == '$' || c == '@' || c == '%') {
33 4609 } else if (c == '$' || c == '@' || c == '%') {
372 3088 0 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
2315 773 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
75 698 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
0 698 while (p < end && (isalnum((unsigned char)*p) || *p == '_' || *p == ':'))
375 151 4458 } else if (isdigit((unsigned char)c)) {
377 343 0 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
186 157 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
6 151 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
0 151 while (p < end && (isalnum((unsigned char)*p) || *p == '.' || *p == '_'))
380 293 4165 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
293 0 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
14 279 } else if (c == '=' && p + 1 < end && *(p + 1) == '~') {
385 0 4444 } 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) == '~') {
389 2523 1921 } else if (c == ' ' || c == '\t') {
2523 0 } else if (c == ' ' || c == '\t') {
391 1426 1097 } else if (isalpha((unsigned char)c) || c == '_') {
25 1401 } else if (isalpha((unsigned char)c) || c == '_') {
394 5403 3 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
4187 1216 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
97 1119 while (p < end && (isalnum((unsigned char)*p) || *p == '_'))
406 16 215 if (c == '\\' && p + 1 < end) {
16 0 if (c == '\\' && p + 1 < end) {
408 22 193 } else if (c == '"') {
415 1 282 if (c == '\\' && p + 1 < end) {
1 0 if (c == '\\' && p + 1 < end) {
417 47 235 } else if (c == '\'') {
424 3 20 if (c == '\\' && p + 1 < end) {
3 0 if (c == '\\' && p + 1 < end) {
426 3 17 } else if (c == ctx->rx_delim) {
431 3 0 while (p < end && isalpha((unsigned char)*p))
0 3 while (p < end && isalpha((unsigned char)*p))
440 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) {
442 331 38 } else if (ctx->q_close != ctx->q_open) {
444 4 327 if (c == ctx->q_open) {
446 27 300 } else if (c == ctx->q_close) {
448 23 4 if (ctx->q_depth == 0) {
450 18 5 if (ctx->q_sections <= 0) {
455 27 0 while (p < end && isalpha((unsigned char)*p))
9 18 while (p < end && isalpha((unsigned char)*p))
462 5 0 while (p < end && (*p == ' ' || *p == '\t'))
0 5 while (p < end && (*p == ' ' || *p == '\t'))
0 5 while (p < end && (*p == ' ' || *p == '\t'))
464 5 0 if (p < end) {
475 9 29 if (c == ctx->q_close) {
477 5 4 if (ctx->q_sections <= 0) {
482 8 0 while (p < end && isalpha((unsigned char)*p))
3 5 while (p < end && isalpha((unsigned char)*p))
516 896 1186 if (ctx->state == ESHU_POD) {
517 558 338 if (content < eol && eshu_pl_is_pod_end(content, eol)) {
22 536 if (content < eol && eshu_pl_is_pod_end(content, eol)) {
519 22 0 if (ctx->pod_buf.len > 0) {
543 1144 42 if (ctx->state == ESHU_HEREDOC || ctx->state == ESHU_HEREDOC_INDENT) {
3 1141 if (ctx->state == ESHU_HEREDOC || ctx->state == ESHU_HEREDOC_INDENT) {
549 12 33 if (eshu_pl_is_heredoc_end(ctx, line_start, eol)) {
558 141 1000 if (content >= eol) {
566 665 335 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
24 641 if (content == line_start && eshu_pl_is_pod_start(content, eol)) {
576 964 12 if (ctx->state == ESHU_QW || ctx->state == ESHU_QQ ||
954 10 if (ctx->state == ESHU_QW || ctx->state == ESHU_QQ ||
577 954 0 ctx->state == ESHU_Q || ctx->state == ESHU_REGEX) {
0 954 ctx->state == ESHU_Q || ctx->state == ESHU_REGEX) {
580 22 0 if (ctx->q_close && *content == ctx->q_close)
7 15 if (ctx->q_close && *content == ctx->q_close)
593 747 207 if (*content == '}' || *content == ')' || *content == ']') {
743 4 if (*content == '}' || *content == ')' || *content == ']') {
9 734 if (*content == '}' || *content == ')' || *content == ']') {
595 0 220 if (indent_depth < 0) indent_depth = 0;
606 12 942 if (ctx->heredoc_pending) {
608 1 11 ctx->state = ctx->heredoc_indented ? ESHU_HEREDOC_INDENT : ESHU_HEREDOC;
629 2082 113 while (p < end) {
632 2079 3 if (eshu_in_range(cfg, line_num)) {
643 2082 0 if (*p == '\n') p++;
649 2 111 if (ctx.pod_buf.len > 0) {