line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Todo; |
2
|
52
|
|
|
52
|
|
667
|
use strict; |
|
52
|
|
|
|
|
94
|
|
|
52
|
|
|
|
|
1518
|
|
3
|
52
|
|
|
52
|
|
271
|
use warnings; |
|
52
|
|
|
|
|
109
|
|
|
52
|
|
|
|
|
1416
|
|
4
|
|
|
|
|
|
|
|
5
|
52
|
|
|
52
|
|
273
|
use Carp qw/croak/; |
|
52
|
|
|
|
|
130
|
|
|
52
|
|
|
|
|
2851
|
|
6
|
52
|
|
|
52
|
|
363
|
use Test2::Util::HashBase qw/hub _filter reason/; |
|
52
|
|
|
|
|
177
|
|
|
52
|
|
|
|
|
543
|
|
7
|
|
|
|
|
|
|
|
8
|
52
|
|
|
52
|
|
12232
|
use Test2::API qw/test2_stack/; |
|
52
|
|
|
|
|
155
|
|
|
52
|
|
|
|
|
3452
|
|
9
|
|
|
|
|
|
|
|
10
|
52
|
|
|
52
|
|
364
|
use overload '""' => \&reason, fallback => 1; |
|
52
|
|
|
|
|
120
|
|
|
52
|
|
|
|
|
624
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
105
|
|
|
105
|
0
|
2964
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
105
|
|
|
|
|
606
|
my $reason = $self->{+REASON}; |
18
|
105
|
50
|
|
|
|
290
|
croak "The 'reason' attribute is required" unless defined $reason; |
19
|
|
|
|
|
|
|
|
20
|
105
|
|
66
|
|
|
515
|
my $hub = $self->{+HUB} ||= test2_stack->top; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$self->{+_FILTER} = $hub->pre_filter( |
23
|
|
|
|
|
|
|
sub { |
24
|
391
|
|
|
391
|
|
53896
|
my ($active_hub, $event) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Turn a diag into a note |
27
|
391
|
100
|
|
|
|
1858
|
return Test2::Event::Note->new(%$event) if ref($event) eq 'Test2::Event::Diag'; |
28
|
|
|
|
|
|
|
|
29
|
287
|
100
|
|
|
|
760
|
if ($active_hub == $hub) { |
30
|
283
|
100
|
|
|
|
2031
|
$event->set_todo($reason) if $event->can('set_todo'); |
31
|
283
|
|
|
|
|
3524
|
$event->add_amnesty({tag => 'TODO', details => $reason}); |
32
|
283
|
100
|
|
|
|
12045
|
$event->set_effective_pass(1) if $event->isa('Test2::Event::Ok'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
4
|
|
|
|
|
56
|
$event->add_amnesty({tag => 'TODO', details => $reason, inherited => 1}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
287
|
|
|
|
|
1431
|
return $event; |
39
|
|
|
|
|
|
|
}, |
40
|
105
|
|
|
|
|
7466
|
inherit => 1, |
41
|
|
|
|
|
|
|
todo => $reason, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub end { |
46
|
156
|
|
|
156
|
1
|
680
|
my $self = shift; |
47
|
156
|
100
|
|
|
|
811
|
my $hub = $self->{+HUB} or return; |
48
|
|
|
|
|
|
|
|
49
|
105
|
|
|
|
|
622
|
$hub->pre_unfilter($self->{+_FILTER}); |
50
|
105
|
|
|
|
|
2666
|
delete $self->{+HUB}; |
51
|
105
|
|
|
|
|
863
|
delete $self->{+_FILTER}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub DESTROY { |
55
|
105
|
|
|
105
|
|
861
|
my $self = shift; |
56
|
105
|
|
|
|
|
347
|
$self->end; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |