Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/Test2/Event/Plan.pm |
Statements | Executed 25 statements in 416µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 10µs | 34µs | facet_data | Test2::Event::Plan::
1 | 1 | 1 | 10µs | 11µs | BEGIN@2 | Test2::Event::Plan::
1 | 1 | 1 | 9µs | 25µs | BEGIN@3 | Test2::Event::Plan::
1 | 1 | 1 | 7µs | 7µs | BEGIN@8 | Test2::Event::Plan::
1 | 1 | 1 | 6µs | 19µs | init | Test2::Event::Plan::
1 | 1 | 1 | 4µs | 21µs | BEGIN@11 | Test2::Event::Plan::
1 | 1 | 1 | 4µs | 53µs | BEGIN@9 | Test2::Event::Plan::
0 | 0 | 0 | 0s | 0s | sets_plan | Test2::Event::Plan::
0 | 0 | 0 | 0s | 0s | summary | Test2::Event::Plan::
0 | 0 | 0 | 0s | 0s | terminate | Test2::Event::Plan::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Test2::Event::Plan; | ||||
2 | 2 | 18µs | 2 | 13µs | # spent 11µs (10+2) within Test2::Event::Plan::BEGIN@2 which was called:
# once (10µs+2µs) by Test2::API::BEGIN@95 at line 2 # spent 11µs making 1 call to Test2::Event::Plan::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 2 | 34µs | 2 | 40µs | # spent 25µs (9+16) within Test2::Event::Plan::BEGIN@3 which was called:
# once (9µs+16µs) by Test2::API::BEGIN@95 at line 3 # spent 25µs making 1 call to Test2::Event::Plan::BEGIN@3
# spent 16µs making 1 call to warnings::import |
4 | |||||
5 | 1 | 400ns | our $VERSION = '1.302198'; | ||
6 | |||||
7 | |||||
8 | 2 | 21µs | 1 | 7µs | # spent 7µs within Test2::Event::Plan::BEGIN@8 which was called:
# once (7µs+0s) by Test2::API::BEGIN@95 at line 8 # spent 7µs making 1 call to Test2::Event::Plan::BEGIN@8 |
9 | 2 | 18µs | 2 | 102µs | # spent 53µs (4+49) within Test2::Event::Plan::BEGIN@9 which was called:
# once (4µs+49µs) by Test2::API::BEGIN@95 at line 9 # spent 53µs making 1 call to Test2::Event::Plan::BEGIN@9
# spent 49µs making 1 call to Test2::Util::HashBase::import |
10 | |||||
11 | 2 | 292µs | 2 | 37µs | # spent 21µs (4+16) within Test2::Event::Plan::BEGIN@11 which was called:
# once (4µs+16µs) by Test2::API::BEGIN@95 at line 11 # spent 21µs making 1 call to Test2::Event::Plan::BEGIN@11
# spent 16µs making 1 call to Exporter::import |
12 | |||||
13 | 1 | 1µs | my %ALLOWED = ( | ||
14 | 'SKIP' => 1, | ||||
15 | 'NO PLAN' => 1, | ||||
16 | ); | ||||
17 | |||||
18 | # spent 19µs (6+13) within Test2::Event::Plan::init which was called:
# once (6µs+13µs) by Test2::Util::HashBase::_new at line 155 of Test2/Util/HashBase.pm | ||||
19 | 1 | 3µs | if ($_[0]->{+DIRECTIVE}) { | ||
20 | $_[0]->{+DIRECTIVE} = 'SKIP' if $_[0]->{+DIRECTIVE} eq 'skip_all'; | ||||
21 | $_[0]->{+DIRECTIVE} = 'NO PLAN' if $_[0]->{+DIRECTIVE} eq 'no_plan'; | ||||
22 | |||||
23 | confess "'" . $_[0]->{+DIRECTIVE} . "' is not a valid plan directive" | ||||
24 | unless $ALLOWED{$_[0]->{+DIRECTIVE}}; | ||||
25 | } | ||||
26 | else { | ||||
27 | confess "Cannot have a reason without a directive!" | ||||
28 | 1 | 500ns | if defined $_[0]->{+REASON}; | ||
29 | |||||
30 | confess "No number of tests specified" | ||||
31 | 1 | 500ns | unless defined $_[0]->{+MAX}; | ||
32 | |||||
33 | confess "Plan test count '" . $_[0]->{+MAX} . "' does not appear to be a valid positive integer" | ||||
34 | 1 | 15µs | 1 | 13µs | unless $_[0]->{+MAX} =~ m/^\d+$/; # spent 13µs making 1 call to CORE::match |
35 | |||||
36 | 1 | 1µs | $_[0]->{+DIRECTIVE} = ''; | ||
37 | } | ||||
38 | } | ||||
39 | |||||
40 | sub sets_plan { | ||||
41 | my $self = shift; | ||||
42 | return ( | ||||
43 | $self->{+MAX}, | ||||
44 | $self->{+DIRECTIVE}, | ||||
45 | $self->{+REASON}, | ||||
46 | ); | ||||
47 | } | ||||
48 | |||||
49 | sub terminate { | ||||
50 | my $self = shift; | ||||
51 | # On skip_all we want to terminate the hub | ||||
52 | return 0 if $self->{+DIRECTIVE} && $self->{+DIRECTIVE} eq 'SKIP'; | ||||
53 | return undef; | ||||
54 | } | ||||
55 | |||||
56 | sub summary { | ||||
57 | my $self = shift; | ||||
58 | my $max = $self->{+MAX}; | ||||
59 | my $directive = $self->{+DIRECTIVE}; | ||||
60 | my $reason = $self->{+REASON}; | ||||
61 | |||||
62 | return "Plan is $max assertions" | ||||
63 | if $max || !$directive; | ||||
64 | |||||
65 | return "Plan is '$directive', $reason" | ||||
66 | if $reason; | ||||
67 | |||||
68 | return "Plan is '$directive'"; | ||||
69 | } | ||||
70 | |||||
71 | # spent 34µs (10+24) within Test2::Event::Plan::facet_data which was called:
# once (10µs+24µs) by Test2::Hub::process at line 343 of Test2/Hub.pm | ||||
72 | 1 | 300ns | my $self = shift; | ||
73 | |||||
74 | 1 | 3µs | 1 | 24µs | my $out = $self->common_facet_data; # spent 24µs making 1 call to Test2::Event::common_facet_data |
75 | |||||
76 | $out->{control}->{terminate} = $self->{+DIRECTIVE} eq 'SKIP' ? 0 : undef | ||||
77 | 1 | 2µs | unless defined $out->{control}->{terminate}; | ||
78 | |||||
79 | 1 | 1µs | $out->{plan} = {count => $self->{+MAX}}; | ||
80 | 1 | 500ns | $out->{plan}->{details} = $self->{+REASON} if defined $self->{+REASON}; | ||
81 | |||||
82 | 1 | 700ns | if (my $dir = $self->{+DIRECTIVE}) { | ||
83 | $out->{plan}->{skip} = 1 if $dir eq 'SKIP'; | ||||
84 | $out->{plan}->{none} = 1 if $dir eq 'NO PLAN'; | ||||
85 | } | ||||
86 | |||||
87 | 1 | 2µs | return $out; | ||
88 | } | ||||
89 | |||||
90 | |||||
91 | 1 | 3µs | 1; | ||
92 | |||||
93 | __END__ |