Branch Coverage

script/tt
Criterion Covered Total %
branch 127 248 51.2


line true false branch
3 0 2 if (@ARGV and @ARGV[0] =~ /^\w/)
4 0 0 /^-{1,2}h\w{0,3}$/ ? :
22 25 0 @_ > 1 ? :
19 25 @_ == 1 ? :
34 6 7 unless -d $File::Find::name
35 5 4 if -d $$self
37 6 0 $cb ? :
41 6 0 $_[0]->basename =~ /^(\d+)-(\d+)_(.*)\.trc$/ ? :
45 0 15 unless open my $file, '<', $$self
54 0 6 unless open my $file, '>', $$self
55 0 6 unless defined $file->syswrite($content)
94 0 0 if @_ and -f $_[0]
95 0 0 if $self->year or $self->month or not -t STDIN
115 1 1 $event->{'minutes'} >= $self->config('round_up_at') ? :
123 2 10 if &blessed($val) and $val->can('ymd')
124 2 10 if ref $val eq 'ARRAY'
143 0 1 if $for eq 'app'
147 0 1 unless open my $POD, '<', $INC{'App/tt.pm'}
150 9 189 if /^=head2 $for/ ... /^=(head|cut)/
155 0 1 unless @help
180 2 0 $res->{'interval'} eq 'month' ? :
181 1 1 if @table > 3
189 0 2 if ($self->config('hours_per_month') and $res->{'interval'} eq 'month')
191 0 0 $days > 0 ? :
192 0 0 $days <= 0 ? :
203 1 1 unless $start and $stop
210 0 1 if (-e $trc_file)
215 1 0 if $self->_save($event)
227 0 2 unless $event->{'project'} and $event->{'start'}
230 0 2 unless $self->_save($event)
239 1 2 if $exit_code == 3
248 1 2 if (not $event->{'start'}) { }
1 1 elsif ($event->{'stop'}) { }
273 1 10 unless ($self->{'config'})
276 2 0 unless -r $path
277 0 0 unless open my $CONFIG, '<', $path
279 0 0 unless $line =~ /^(?:TT_)?(\w+)=(.+)/
299 0 0 $trc_file ? :
302 0 0 unless $event->{'start'}
307 0 0 unless $event->{$k}
0 0 if $k eq 'tags'
308 0 0 if $k eq 'start' or $k eq 'stop' and $event->{$k}
317 0 0 unless my($k, $v) = /^(\w+)\s*:\s*(.+)/
318 0 0 if $k eq 'tags'
319 0 0 if $k eq 'start'
320 0 0 if $k eq 'stop'
324 0 0 unless $self->_save($event)
325 0 0 if $prev
326 0 0 unless $trc_file eq $event->{'path'}
334 0 7 if -d '.git'
350 4 18 if (ref $data eq 'ARRAY')
351 0 4 $data->[0][-1] eq '{X}' ? :
352 4 0 $PTY ? :
356 3 8 unless ref $row eq 'ARRAY'
361 26 10 if $len >= ($spec[$col] // 0)
364 8 0 if $w >= ($width // 0)
370 8 3 ref $_ ? :
377 12 10 if ($data =~ s/^(\d*)(>|!)\s//)
378 4 8 if $1 eq '2' or $2 eq '!'
380 12 0 if $PTY
383 7 15 if @_ == 2
403 4 4 if $trc_file and -r $trc_file
405 2 0 if $_[0]->parse
406 2 2 if $trc_file and -r $trc_file
427 0 0 if $pl < length $p
435 2 11 ref $duration ? :
443 4 9 unless $sep
444 0 9 if $sep eq '-hm'
445 4 5 if $sep eq 'hm'
453 0 10 unless $event->{'tags'}
466 0 0 if /^(-\d+)(m|y|month|year)$/
467 0 0 if /^(-\d+)$/
468 0 0 if /^(month|year)/
469 0 0 if /^--fill/
476 0 4 if ($res->{'interval'} =~ /^y/) { }
486 0 4 unless my($date, $hms, $project) = $_[0]->parse
488 0 4 if @project_re and not grep({$event->{'project'} =~ /$_/;} @project_re)
489 0 4 if $tags and not grep({$tags =~ /\b$_\b/;} @{$$event{'tags'};})
494 0 0 @{$res->{'log'};} ? :
0 4 if $res->{'fill'}
498 0 2 if @{$res->{'log'};} and not $res->{'log'}[-1]{'project'} and $res->{'log'}[-1]{'start'}->mday == $event->{'start'}->mday
504 0 4 if (my $method = $self->can(sprintf('_group_by_%s', $self->group_by || 'nothing')))
514 0 0 if $self->month and not $self->year
516 0 0 if $self->year
517 0 0 if $self->month
528 0 0 unless (-t STDIN and $self->year || $self->month)
530 0 0 unless $code =~ /^\s*sub\b/s
531 0 0 unless $code = eval "use 5.10.1;use strict;use warnings;$code"
537 0 0 unless $info{'file'} =~ /$re$/
539 0 0 unless $code
542 0 0 if $code and $self->$code($event)
543 0 0 unless $info{'file'} eq $event->{'path'}
553 2 2 if (my $duration = $event->{'stop'} && $event->{'start'} && $event->{'stop'} - $event->{'start'})
556 0 4 if ($event->{'stop'} and $event->{'seconds'} < $self->config('min_time'))
566 4 0 if $event->{'start'}
567 2 2 if $event->{'stop'}
570 1 3 unless -d $event->{'path'}->dirname
577 0 7 if @_
578 0 7 unless $self->tag
585 3 2 if not $event->{'start'} or $event->{'stop'}
590 1 1 if ($duration->seconds < $self->config('min_time'))
594 0 1 unless unlink $event->{'path'}
598 1 0 if ($self->_save($event))
612 27 7 @_ == 1 ? :
614 28 6 if ($t{'str'})
616 6 22 if not $hms and $ymd =~ /:/
617 0 28 if $ymd and not $ymd =~ /^[\d-]+$/
618 0 28 if $hms and not $hms =~ /^[\d:]+$/
619 19 9 if $ymd =~ s/(\d{4})//
620 20 8 if $ymd =~ s/0?(\d{1,2})-(\d+)/$2/
621 22 6 if $ymd =~ s/0?(\d{1,2})//
622 28 0 if $hms =~ s/0?(\d{1,2})//
623 25 3 if $hms =~ s/0?(\d{1,2})//
624 23 5 if $hms =~ s/0?(\d{1,2})//
628 0 34 unless ref $ref
632 5 6 defined $t{'H'} || defined $t{'M'} ? :
633 3 6 defined $t{'H'} ? :
636 0 34 if $t{'m'} <= 0
637 0 34 if $t{'m'} > 12
642 1 33 unless (eval { do { $t{'iso'} = sprintf('%s-%02s-%02sT%02s:%02s:%02s', @t{'Y', 'm', 'd', 'H', 'M', 'S'}); $t{'tp'} = 'Time::Piece'->strptime("$t{'iso'}+0000", '%Y-%m-%dT%H:%M:%S%z') } })
645 1 0 if $t{'str'}
659 0 0 if ($start->day_of_week != 0 and $start->day_of_week != 6)
660 0 0 if $start < $NOW
666 0 0 $NOW->hour > 12 ? :