Branch Coverage

script/rt
Criterion Covered Total %
branch 68 594 11.4


line true false branch
55 0 1 if ($ARGV[0] and $ARGV[0] =~ /^(?:--help|-h)$/)
98 0 1 if delete $config{'externalauth'}
106 0 0 if $config{'debug'} >= shift()
156 0 1 unless @ARGV
157 0 1 if $ARGV[0] eq "rt"
158 1 0 if (@ARGV and exists $actions{$ARGV[0]}) { }
180 0 0 if /^#/ or /^\s*$/
193 0 0 if defined $session->cookie
205 0 1 defined $rv ? :
209 1 0 unless (%help)
213 14 16 ref $title eq 'ARRAY' ? :
222 1 0 if $action and $actions{$action} eq \&main::help
223 1 0 unless ($action or $type)
226 0 0 if (exists $help{$_})
228 1 0 unless ($key)
231 0 0 if ($_ =~ s/s$// and exists $help{$_})
236 0 1 if ($type and $action)
243 0 0 if ($type and $action) { }
244 0 0 if ($key eq "$type.$action") { }
0 0 elsif ($key eq $action) { }
263 0 0 if ($config{'orderby'})
274 0 0 if (/^-t$/) { }
0 0 elsif (/^-S$/) { }
0 0 elsif (/^-o$/) { }
0 0 elsif (/^-([isl])$/) { }
0 0 elsif (/^-q$/) { }
0 0 elsif (/^-r$/) { }
0 0 elsif (/^-f$/) { }
0 0 elsif (not defined $q || /^-/) { }
275 0 0 unless defined($type = get_type_argument())
278 0 0 unless get_var_argument(\%data)
294 0 0 unless ($ARGV[0] =~ /^(?:(?:$field,)*$field)$/)
299 0 0 unless $data{'format'}
306 0 0 /^-/ ? :
311 0 0 unless ($rawprint or exists $data{'format'})
315 0 0 if ($reverse_sort and $data{'orderby'} =~ /^-/) { }
0 0 elsif ($reverse_sort) { }
323 0 0 unless (defined $q)
324 0 0 if ($type eq 'ticket') { }
332 0 0 if ($type ne "ticket")
336 0 0 unless (defined $q)
337 0 0 $type ? :
343 0 0 if ($type eq "ticket")
344 0 0 if ($q =~ /^\d+$/) { }
347 0 0 if $q =~ /^\d+$/
352 0 0 if $q =~ /^[\w\-]+$/
356 0 0 if $queue
357 0 0 if $queue and $q and not $q =~ /Queue\s*=/i and not $q =~ /id\s*=/i
369 0 0 if $bad
371 0 0 unless $rawprint
373 0 0 if ($rawprint) { }
393 0 0 if /^#\d+/
394 0 0 if (/^-t$/) { }
0 0 elsif (/^-S$/) { }
0 0 elsif (/^-([isl])$/) { }
0 0 elsif (/^-$/ and not $slurped) { }
0 0 elsif (/^-f$/) { }
0 0 elsif (/^\d+$/ and my $spc2 = is_object_spec("ticket/$_", $type)) { }
0 0 elsif (m[^\d+/] and my $spc3 = is_object_spec("ticket/$_", $type)) { }
0 0 elsif (my $spec = is_object_spec($_, $type)) { }
395 0 0 unless defined($type = get_type_argument())
398 0 0 unless get_var_argument(\%data)
407 0 0 unless (is_object_spec($_, $type))
416 0 0 unless ($ARGV[0] =~ /^(?:(?:$field,)*$field)$/)
431 0 0 if $_ =~ m[/content$]
435 0 0 if $_ =~ m[/content$] or $_ =~ m[/links] or not $_ =~ /^ticket/
438 0 0 /^-/ ? :
443 0 0 unless ($rawprint)
444 0 0 if $histspec
445 0 0 unless exists $data{'format'}
448 0 0 unless (@objects)
453 0 0 if $bad
460 0 0 unless ($r->content_type =~ m[^text/])
464 0 0 if ($rawprint) { }
494 0 0 if /^#\d+/
496 0 0 if (/^-e$/) { }
0 0 elsif (/^-i$/) { }
0 0 elsif (/^-o$/) { }
0 0 elsif (/^-ct$/) { }
0 0 elsif (/^-t$/) { }
0 0 elsif (/^-S$/) { }
0 0 elsif (/^-$/ and not $slurped || $input) { }
0 0 elsif (/^set$/i) { }
0 0 elsif (/^(?:add|del)$/i) { }
0 0 elsif (/^\d+$/ and my $spc2 = is_object_spec("ticket/$_", $type)) { }
0 0 elsif (my $spec = is_object_spec($_, $type)) { }
501 0 0 unless defined($type = get_type_argument())
504 0 0 unless get_var_argument(\%data)
509 0 0 unless (is_object_spec($_, $type))
522 0 0 $op =~ /^\+/ ? :
0 0 $op eq '=' ? :
528 0 0 unless ($vars)
536 0 0 $_ eq 'add' ? :
545 0 0 unless ($vars)
558 0 0 /^-/ ? :
564 0 0 if ($action =~ /^ed(?:it)?$/) { }
565 0 0 unless (@objects)
571 0 0 if (@objects)
575 0 0 unless ($type)
579 0 0 if defined $type
582 0 0 if $bad
593 0 0 if ($input) { }
0 0 elsif ($edit or %main::add or %main::del or not $cl or @new_objects) { }
603 0 0 if ($cl)
604 0 0 if ($text) { }
612 0 0 if $e or not @$o
620 0 0 if (exists $main::add{lc $key})
623 0 0 if $val =~ /[,\n]/
625 0 0 if (exists $main::del{lc $key})
631 0 0 if (exists $main::set{lc $key})
664 0 0 if ($output)
670 0 0 if exists $main::set{'attachment'}
677 0 0 if ($type and $type eq "ticket" and not $text =~ /^Content-Type:/m)
678 0 0 if $content_type and $content_type ne "text/plain"
682 0 0 if ($edit or not $input || $cl)
687 0 0 unless exists $form->[2]{'Attachment'}
690 0 0 unless -f $f
696 0 0 unless $newtext
698 0 0 $synerr && $newtext eq $text ? :
708 0 0 if ($text)
710 0 0 if ($r->code == 409)
713 0 0 if ($edit or not $input || $cl) { }
736 0 0 if (@ARGV)
738 0 0 if m[^(?:ticket/)?($idlist)$]
740 0 0 unless ($id)
744 0 0 if (@ARGV) { }
745 0 0 if ($action eq 'subject') { }
0 0 elsif ($action eq 'give') { }
754 0 0 if ($action eq 'delete' or $action eq 'del') { }
0 0 elsif ($action eq 'resolve' or $action eq 'res') { }
0 0 elsif ($action eq 'take') { }
0 0 elsif ($action eq 'untake') { }
764 0 0 if (@ARGV)
768 0 0 unless ($what)
772 0 0 if $bad
789 0 0 if (/^-e$/) { }
0 0 elsif (/^-(?:[abcmws]|ct)$/) { }
0 0 elsif (not $id and m[^(?:ticket/)?($idlist)$]) { }
793 0 0 unless (@ARGV)
798 0 0 if (/-a/) { }
0 0 elsif (/-ct/) { }
0 0 elsif (/-s/) { }
0 0 elsif (/-([bc])/) { }
0 0 elsif (/-m/) { }
0 0 elsif (/-w/) { }
799 0 0 unless (-f $ARGV[0] and -r $ARGV[0])
812 0 0 $_ eq '-b' ? :
817 0 0 if ($msg =~ /^-$/)
828 0 0 /^-/ ? :
834 0 0 unless ($id)
839 0 0 if $bad
856 0 0 if ($status ne "")
862 0 0 if ($edit or not $msg)
868 0 0 unless -f $f
874 0 0 unless $tmp
898 0 0 if /^#\d+/
900 0 0 if (/^\d+$/) { }
909 0 0 unless (@id == 2)
910 0 0 @id > 2 ? :
915 0 0 if $bad
934 0 0 if (/^-d$/) { }
0 0 elsif (/^-t$/) { }
938 0 0 unless defined($type = get_type_argument())
946 0 0 unless $type
948 0 0 if (@ARGV == 3) { }
950 0 0 if ($type eq "ticket" and not exists $ltypes{lc $rel})
957 0 0 @ARGV < 3 ? :
961 0 0 if $bad
976 0 0 if (@ARGV == 1) { }
978 0 0 unless ($id =~ /^\d+$/)
996 0 0 @ARGV < 1 ? :
1000 0 0 if $bad
1031 0 0 if (defined $content)
1032 0 0 ref $content ? :
1053 0 0 $config{'server'} =~ /^https/ ? :
1056 0 0 if ($config{'auth'} eq 'gssapi') { }
0 0 elsif ($config{'auth'} eq 'basic') { }
0 0 elsif (not defined $session->cookie) { }
1058 0 0 unless eval { do { require GSSAPI; 1 } }
1060 0 0 unless eval { do { require LWP::Authen::Negotiate; 1 } }
1064 0 0 unless $config{'passwd'}
1069 0 0 unless $config{'passwd'}
1075 0 0 if (@$data) { }
1082 0 0 if %$h
1089 0 0 if ($res->is_success) { }
1096 0 0 if $text
1099 0 0 unless ($status =~ m[^RT/\d+(?:\S+) (\d+) ([\w\s]+)$])
1101 0 0 if $config{'debug'} < 3
1111 0 0 if $res->is_success or $res->code != 401
1113 0 0 unless ($res->is_success)
1116 0 0 if ($res->code == 401) { }
0 0 elsif ($res->code != 409) { }
1118 0 0 if (exists $d{'user'}) { }
0 0 elsif ($req->header('Cookie')) { }
1126 0 0 unless $uri eq "$REST/logout"
1175 0 0 defined $cookie ? :
1189 0 0 if defined $cookie
1198 0 0 if (defined $cookie and $cookie =~ /^RT_SID_(.[^;,\s]+=[0-9A-Fa-f]+);/)
1208 1 0 unless open my $handle, "<", $file
1214 0 0 if /^$/ or /^#/
1215 0 0 unless m[^(https?://[^ ]+) (.+) ([^;,\s]+=[0-9A-Fa-f]+)$]
1227 0 0 unless open my $handle, ">", "$file"
1233 0 0 if (defined $sid)
1264 1 0 if $_[0]
1271 37 119 if $line eq ""
1273 29 90 if ($line eq '--') { }
79 11 elsif ($state != -1) { }
1276 29 0 if ($e or $c or @$o)
1283 0 79 if ($state == 0 and $line =~ /^#/) { }
78 1 elsif ($state <= 1 and $line =~ /^($field):(?:\s+(.*))?$/) { }
1 0 elsif (not $line =~ /^#/) { }
1296 48 30 defined $2 && length $2 ? :
1307 31 452 if not $ws or length $ls < length $ws
1311 60 18 unless exists $k->{$f}
1321 0 1 $line =~ /^>>/ ? :
1330 0 0 if $e or $c or @$o
1333 1 1 if ref $k->{$l} eq "ARRAY"
1348 0 1 if ($c)
1352 0 1 if ($e) { }
1 0 elsif ($o) { }
1361 1 1 ref $v eq 'ARRAY' ? :
1364 0 2 if length $sp > 16
1367 1 2 if ($v =~ /\n/) { }
0 2 elsif ($line and length($line) + length($v) - rindex($line, "\n") >= 70) { }
1371 0 1 if ($line) { }
1 0 elsif (@lines and not $lines[-1] =~ /\n\n$/) { }
1386 1 1 $line ? :
1390 0 2 unless @values
1391 1 1 if ($line)
1392 0 1 if ($line =~ /\n/)
1393 0 0 if (@lines and not $lines[-1] =~ /\n\n$/)
1422 0 8 if (exists $ENV{"RT$k"})
1434 0 1 if ($rc =~ m[^/]) { }
1445 0 5 if (-r $file)
1455 0 3 if -r $_
1468 0 0 unless open my $handle, "<", $file
1472 0 0 if /^#/ or /^\s*$/
1474 0 0 if (/^(externalauth|auth|user|passwd|server|query|orderby|queue)\s+(.*)\s?$/) { }
1497 0 0 if ($@)
1518 0 0 if $error and $ntext eq $text
1525 0 0 if ($e) { }
0 0 elsif (not @$o) { }
1535 0 0 unless ($status)
1557 0 0 if system $editor, $handle->filename
1559 0 0 unless open $handle, "<", $handle->filename
1569 0 78 ref $val eq 'ARRAY' ? :
1571 18 60 if (exists $hash->{$key}) { }
1572 14 4 unless (ref $hash->{$key} eq "ARRAY")
1573 14 0 $hash->{$key} ne '' ? :
1589 1 0 ref $val eq 'ARRAY' ? :
1593 0 2 unless $line =~ s/^ \s* # Trim leading whitespace (?: (") # Quoted string ((?>[^\\"]*(?:\\.[^\\"]*)*))" | (') # Single-quoted string ((?>[^\\']*(?:\\.[^\\']*)*))' | q\{(.*?)\} # A perl-ish q{} string; this does # no paren balancing, however, and # only exists for back-compat | (.*?) # Anything else, until the next comma ) \s* # Trim trailing whitespace (?: \Z # Finish at end-of-line | , # Or a comma ) //sx
1618 0 2 $3 ? :
0 2 $1 ? :
1621 0 2 if ($5)
1625 0 2 if ($strip) { }
1626 0 0 if $quote
1643 0 0 /^(\d+)-(\d+)$/ ? :
1648 0 0 defined $main::a->[1] ? :
0 0 !(defined $main::a->[1] || defined $main::b->[1]) ? :
0 0 if (defined $main::a->[1] and defined $main::b->[1]) { }
0 0 defined /^(\d+)$/ ? :
1664 0 0 if (@ARGV) { }
1666 0 0 unless ($type =~ /^[A-Za-z0-9_.-]+$/)
1684 0 0 if (@ARGV) { }
1686 0 0 if (my($k, $v) = $kv =~ /^($field)=(.*)$/) { }
1703 0 0 if defined $type
1704 0 0 if $spec =~ m[^$name/(?:$idlist|$labels)(?:/.*)?$]o
1711 0 0 if defined $action
1712 0 0 if defined $type
1722 0 0 if (/(\w{3})\s+(\d\d?)\s+(\d\d):(\d\d):(\d\d)\s+(\d{4})/) { }
0 0 elsif (/(\d{4})-(\d\d)-(\d\d)\s+(\d\d):(\d\d):(\d\d)/) { }
1724 0 0 if exists $month{$monstr}
1728 0 0 if ($yr and defined $mon and $day and defined $hr and defined $sec) { }
1738 0 0 unless $new
1739 0 0 unless $old =~ /^\d+$/
1740 0 0 unless $new =~ /^\d+$/
1741 0 0 unless $old and $new
1754 0 0 if $diff < $seconds{$_}
1766 0 0 if ($k)
1769 0 0 if $k->{'Cc'}
1770 0 0 if $k->{'AdminCc'}
1777 0 0 if not $k->{'id'} or exists $k->{'Queue'}
1778 0 0 if (exists $k->{'Created'})
1782 0 0 if (exists $k->{'Description'})
1788 0 0 if exists $k->{'Content'} and not $k->{'Content'} =~ /to have no content$/ and ($k->{'Type'} || '') ne "EmailRecord"
1790 0 0 if exists $k->{'Attachments'} and $k->{'Attachments'}
1801 0 0 unless $k->{'id'}
1802 0 0 if $heading
1806 0 0 $k->{'Owner'} eq 'Nobody' ? :
1811 0 0 $k->{'Told'} eq 'Not set' ? :
1816 0 0 if ($k->{'Owner'} eq 'Nobody') { }
0 0 elsif ($k->{'Owner'} eq $config{'user'}) { }
1824 0 0 if $heading
1825 0 0 if @me
1826 0 0 if @me
1827 0 0 if @open
1828 0 0 if @open