Branch Coverage

Cwd.xs
Criterion Covered Total %
branch 154 204 75.4


line true false branch
88 1502 57 if (path[0] == '/') {
91 1 1501 if (path[1] == '\0')
96 1 56 if (getcwd(resolved, MAXPATHLEN) == NULL) {
103 1557 0 if (remaining_len >= sizeof(remaining) || resolved_len >= MAXPATHLEN) {
0 1557 if (remaining_len >= sizeof(remaining) || resolved_len >= MAXPATHLEN) {
111 11057 1557 while (remaining_len != 0) {
119 1558 9499 s = p ? p : remaining + remaining_len;
120 0 11057 if ((STRLEN)(s - remaining) >= (STRLEN)sizeof(next_token)) {
127 9499 1558 if (p != NULL)
129 9300 1757 if (resolved[resolved_len - 1] != '/') {
130 0 9300 if (resolved_len + 1 >= MAXPATHLEN) {
137 0 11057 if (next_token[0] == '\0')
139 4 11053 else if (strEQ(next_token, "."))
141 255 10798 else if (strEQ(next_token, "..")) {
146 255 0 if (resolved_len > 1) {
161 0 10798 if (resolved_len >= MAXPATHLEN) {
168 0 10798 if (lstat(resolved, &sb) != 0) {
169 0 0 if (errno == ENOENT && p == NULL) {
0 0 if (errno == ENOENT && p == NULL) {
175 1 10797 if (S_ISLNK(sb.st_mode)) {
179 0 1 if (symlinks++ > MAXSYMLINKS) {
184 0 1 if (slen < 0)
197 0 1 if (symlink[0] == '/') {
200 1 0 } else if (resolved_len > 1) {
213 0 1 if (p != NULL) {
214 0 0 if (symlink[slen - 1] != '/') {
215 0 0 if ((STRLEN)(slen + 1) >= (STRLEN)sizeof(symlink)) {
223 0 0 if (remaining_len >= sizeof(remaining)) {
241 1557 0 if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
4 1553 if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
458 1358 0 return SvPOK(invocant) && SvCUR(invocant) == 16 &&
98 1260 return SvPOK(invocant) && SvCUR(invocant) == 16 &&
70 28 return SvPOK(invocant) && SvCUR(invocant) == 16 &&
472 3 1743 SvGETMAGIC(path);
0 3 SvGETMAGIC(path);
473 4 1742 if(!SvOK(path)) return &PL_sv_undef;
4 0 if(!SvOK(path)) return &PL_sv_undef;
4 0 if(!SvOK(path)) return &PL_sv_undef;
474 1738 4 p = SvPV_nomg(path, plen);
475 6 1736 if(plen == 0) return newSVpvs("");
479 3 1733 if(SvUTF8(path)) SvUTF8_on(retval);
497 908 828 if(p[0] == '/') {
500 107 949 do { p++; } while(p[0] == '/');
501 41 908 if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) {
21 20 if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) {
18 3 if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) {
18 0 if(p[0] == '.' && p[1] == '.' && (p+2 == pe || p[2] == '/')) {
504 20 908 } else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) {
15 5 } else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) {
15 0 } else if(p[0] == '.' && (p+1 == pe || p[1] == '/')) {
510 276 552 } else if(p[0] == '.' && p[1] == '/') {
188 88 } else if(p[0] == '.' && p[1] == '/') {
513 10 189 do { p++; } while(p[0] == '/');
514 2 187 } while(p[0] == '.' && p[1] == '/');
1 1 } while(p[0] == '.' && p[1] == '/');
515 39 149 if(p == pe) *o++ = '.';
517 105 1631 if(p == pe) goto end;
520 763 4716 if(!q) q = pe;
525 763 4716 if(p == pe) goto end;
527 51 4737 do { p++; } while(p[0] == '/');
528 865 3872 if(p == pe) goto end;
529 3319 553 if(p[0] != '.') break;
530 3 550 if(p+1 == pe) goto end;
531 529 21 if(p[1] != '/') break;
540 1 1735 SvTAINT(retval);
1 0 SvTAINT(retval);
572 131 0 dXSTARG;
574 4 127 if (ix == 1 && items != 0)
0 4 if (ix == 1 && items != 0)
577 18 113 XSprePUSH; PUSHTARG;
578 18 113 SvTAINTED_on(TARG);
586 1559 0 dXSTARG;
587 1557 2 char *const path = pathsv ? SvPV_nolen(pathsv) : (char *)".";
1507 50 char *const path = pathsv ? SvPV_nolen(pathsv) : (char *)".";
590 1558 1 if (
599 254 1304 SvTAINTED_on(TARG);
605 254 1305 SvTAINTED_on(TARG);
668 928 0 EXTEND(SP, items+1);
0 928 EXTEND(SP, items+1);
672 55 873 if(invocant_is_unix(self)) {
676 0 873 PUSHMARK(SP);
677 0 873 EXTEND(SP, 2);
696 4 0 EXTEND(SP, items+1);
0 4 EXTEND(SP, items+1);
709 15 415 if(invocant_is_unix(self)) {
710 0 15 if(items == 1) {
714 3 12 if(items == 2) {
722 12 0 if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/')
12 0 if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/')
730 0 415 PUSHMARK(SP);
731 0 415 EXTEND(SP, 2);
733 414 1 PUSHs(items == 1 ? &PL_sv_undef : ST(items-1));
739 6 409 if(items <= 2) {
747 0 409 PUSHMARK(&ST(-1));
753 409 0 pv = SvPV(dir, len);
754 409 0 need_slash = len == 0 || pv[len-1] != '/';
385 24 need_slash = len == 0 || pv[len-1] != '/';
756 385 24 if(need_slash) sv_catsv(RETVAL, SLASH_STRING_SV);
768 1 3 if(items == 0) {
772 1 2 if(items == 1) {
780 2 0 if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/')
2 0 if(SvCUR(RETVAL) == 0 || SvPVX(RETVAL)[SvCUR(RETVAL)-1] != '/')