line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Event::Bail; |
2
|
246
|
|
|
246
|
|
2161
|
use strict; |
|
246
|
|
|
|
|
569
|
|
|
246
|
|
|
|
|
7494
|
|
3
|
246
|
|
|
246
|
|
1291
|
use warnings; |
|
246
|
|
|
|
|
516
|
|
|
246
|
|
|
|
|
13892
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302182'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
246
|
|
|
246
|
|
1518
|
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } |
|
246
|
|
|
|
|
10016
|
|
9
|
246
|
|
|
246
|
|
1703
|
use Test2::Util::HashBase qw{reason buffered}; |
|
246
|
|
|
|
|
520
|
|
|
246
|
|
|
|
|
1752
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Make sure the tests terminate |
12
|
1
|
|
|
1
|
1
|
4
|
sub terminate { 255 }; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
1
|
8
|
sub global { 1 }; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
1
|
8
|
sub causes_fail { 1 } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub summary { |
19
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
20
|
|
|
|
|
|
|
return "Bail out! " . $self->{+REASON} |
21
|
2
|
100
|
|
|
|
14
|
if $self->{+REASON}; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
4
|
return "Bail out!"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
1
|
4
|
sub diagnostics { 1 } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub facet_data { |
29
|
26
|
|
|
26
|
1
|
54
|
my $self = shift; |
30
|
26
|
|
|
|
|
90
|
my $out = $self->common_facet_data; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$out->{control} = { |
33
|
|
|
|
|
|
|
global => 1, |
34
|
|
|
|
|
|
|
halt => 1, |
35
|
26
|
|
|
|
|
98
|
details => $self->{+REASON}, |
36
|
|
|
|
|
|
|
terminate => 255, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
26
|
|
|
|
|
75
|
return $out; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Test2::Event::Bail - Bailout! |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The bailout event is generated when things go horribly wrong and you need to |
57
|
|
|
|
|
|
|
halt all testing in the current file. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use Test2::API qw/context/; |
62
|
|
|
|
|
|
|
use Test2::Event::Bail; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $ctx = context(); |
65
|
|
|
|
|
|
|
my $event = $ctx->bail('Stuff is broken'); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Inherits from L<Test2::Event>. Also defines: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 4 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item $reason = $e->reason |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The reason for the bailout. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SOURCE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The source code repository for Test2 can be found at |
82
|
|
|
|
|
|
|
F<http://github.com/Test-More/test-more/>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 MAINTAINERS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 4 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHORS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over 4 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 COPYRIGHT |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
105
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
See F<http://dev.perl.org/licenses/> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |