line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Event::Fail; |
2
|
246
|
|
|
246
|
|
1864
|
use strict; |
|
246
|
|
|
|
|
571
|
|
|
246
|
|
|
|
|
8203
|
|
3
|
246
|
|
|
246
|
|
1362
|
use warnings; |
|
246
|
|
|
|
|
489
|
|
|
246
|
|
|
|
|
10125
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302182'; |
6
|
|
|
|
|
|
|
|
7
|
246
|
|
|
246
|
|
1520
|
use Test2::EventFacet::Info; |
|
246
|
|
|
|
|
523
|
|
|
246
|
|
|
|
|
14272
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
246
|
|
|
246
|
|
1831
|
require Test2::Event; |
11
|
246
|
|
|
|
|
4087
|
our @ISA = qw(Test2::Event); |
12
|
246
|
|
|
|
|
8673
|
*META_KEY = \&Test2::Util::ExternalMeta::META_KEY; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
246
|
|
|
246
|
|
1780
|
use Test2::Util::HashBase qw{ -name -info }; |
|
246
|
|
|
|
|
683
|
|
|
246
|
|
|
|
|
1842
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
############# |
18
|
|
|
|
|
|
|
# Old API |
19
|
1
|
|
|
1
|
1
|
13
|
sub summary { "fail" } |
20
|
1
|
|
|
1
|
1
|
5
|
sub increments_count { 1 } |
21
|
1
|
|
|
1
|
1
|
6
|
sub diagnostics { 0 } |
22
|
1
|
|
|
1
|
1
|
4
|
sub no_display { 0 } |
23
|
1
|
|
|
1
|
1
|
8
|
sub subtest_id { undef } |
24
|
1
|
|
|
1
|
1
|
4
|
sub terminate { () } |
25
|
12
|
|
|
12
|
1
|
34
|
sub global { () } |
26
|
1
|
|
|
1
|
1
|
5
|
sub sets_plan { () } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub causes_fail { |
29
|
3
|
|
|
3
|
1
|
10
|
my $self = shift; |
30
|
3
|
100
|
66
|
|
|
22
|
return 0 if $self->{+AMNESTY} && @{$self->{+AMNESTY}}; |
|
2
|
|
|
|
|
17
|
|
31
|
1
|
|
|
|
|
6
|
return 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
############# |
35
|
|
|
|
|
|
|
# New API |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add_info { |
38
|
24
|
|
|
24
|
0
|
43
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
24
|
|
|
|
|
51
|
for my $in (@_) { |
41
|
24
|
50
|
|
|
|
135
|
$in = {%$in} if ref($in) ne 'ARRAY'; |
42
|
24
|
|
|
|
|
129
|
$in = Test2::EventFacet::Info->new($in); |
43
|
|
|
|
|
|
|
|
44
|
24
|
|
|
|
|
39
|
push @{$self->{+INFO}} => $in; |
|
24
|
|
|
|
|
98
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub facet_data { |
49
|
52
|
|
|
52
|
1
|
102
|
my $self = shift; |
50
|
52
|
|
|
|
|
237
|
my $out = $self->common_facet_data; |
51
|
|
|
|
|
|
|
|
52
|
52
|
|
|
|
|
134
|
$out->{about}->{details} = 'fail'; |
53
|
|
|
|
|
|
|
|
54
|
52
|
|
|
|
|
158
|
$out->{assert} = {pass => 0, details => $self->{+NAME}}; |
55
|
|
|
|
|
|
|
|
56
|
52
|
100
|
|
|
|
142
|
$out->{info} = [map {{ %{$_} }} @{$self->{+INFO}}] if $self->{+INFO}; |
|
31
|
|
|
|
|
48
|
|
|
31
|
|
|
|
|
148
|
|
|
19
|
|
|
|
|
50
|
|
57
|
|
|
|
|
|
|
|
58
|
52
|
|
|
|
|
213
|
return $out; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=encoding UTF-8 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Test2::Event::Fail - Event for a simple failed assertion |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is an optimal representation of a failed assertion. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
use Test2::API qw/context/; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub fail { |
82
|
|
|
|
|
|
|
my ($name) = @_; |
83
|
|
|
|
|
|
|
my $ctx = context(); |
84
|
|
|
|
|
|
|
$ctx->fail($name); |
85
|
|
|
|
|
|
|
$ctx->release; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SOURCE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The source code repository for Test2 can be found at |
91
|
|
|
|
|
|
|
F<http://github.com/Test-More/test-more/>. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 MAINTAINERS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHORS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over 4 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
114
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
See F<http://dev.perl.org/licenses/> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |