This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Test::Simple from version 1.302056 to 1.302059
[perl5.git] / cpan / Test-Simple / lib / Test2 / Event / Bail.pm
CommitLineData
b4514920
CG
1package Test2::Event::Bail;
2use strict;
3use warnings;
4
061828b3 5our $VERSION = '1.302059';
b4514920
CG
6
7
58818a66 8BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
b4514920
CG
9use Test2::Util::HashBase qw{reason};
10
11sub callback {
12 my $self = shift;
13 my ($hub) = @_;
14
15 $hub->set_bailed_out($self);
16}
17
18# Make sure the tests terminate
19sub terminate { 255 };
20
21sub global { 1 };
22
23sub causes_fail { 1 }
24
25sub summary {
26 my $self = shift;
27 return "Bail out! " . $self->{+REASON}
28 if $self->{+REASON};
29
30 return "Bail out!";
31}
32
33sub diagnostics { 1 }
34
351;
36
37__END__
38
39=pod
40
41=encoding UTF-8
42
43=head1 NAME
44
45Test2::Event::Bail - Bailout!
46
47=head1 DESCRIPTION
48
49The bailout event is generated when things go horribly wrong and you need to
50halt all testing in the current file.
51
52=head1 SYNOPSIS
53
54 use Test2::API qw/context/;
55 use Test2::Event::Bail;
56
57 my $ctx = context();
58 my $event = $ctx->bail('Stuff is broken');
59
60=head1 METHODS
61
62Inherits from L<Test2::Event>. Also defines:
63
64=over 4
65
66=item $reason = $e->reason
67
68The reason for the bailout.
69
70=back
71
72=head1 SOURCE
73
74The source code repository for Test2 can be found at
75F<http://github.com/Test-More/test-more/>.
76
77=head1 MAINTAINERS
78
79=over 4
80
81=item Chad Granum E<lt>exodist@cpan.orgE<gt>
82
83=back
84
85=head1 AUTHORS
86
87=over 4
88
89=item Chad Granum E<lt>exodist@cpan.orgE<gt>
90
91=back
92
93=head1 COPYRIGHT
94
95Copyright 2016 Chad Granum E<lt>exodist@cpan.orgE<gt>.
96
97This program is free software; you can redistribute it and/or
98modify it under the same terms as Perl itself.
99
100See F<http://dev.perl.org/licenses/>
101
102=cut