1package Test2::Event::Bail; 2use strict; 3use warnings; 4 5our $VERSION = '1.302133'; 6 7 8BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } 9use Test2::Util::HashBase qw{reason buffered}; 10 11# Make sure the tests terminate 12sub terminate { 255 }; 13 14sub global { 1 }; 15 16sub causes_fail { 1 } 17 18sub summary { 19 my $self = shift; 20 return "Bail out! " . $self->{+REASON} 21 if $self->{+REASON}; 22 23 return "Bail out!"; 24} 25 26sub diagnostics { 1 } 27 28sub facet_data { 29 my $self = shift; 30 my $out = $self->common_facet_data; 31 32 $out->{control} = { 33 global => 1, 34 halt => 1, 35 details => $self->{+REASON}, 36 terminate => 255, 37 }; 38 39 return $out; 40} 41 421; 43 44__END__ 45 46=pod 47 48=encoding UTF-8 49 50=head1 NAME 51 52Test2::Event::Bail - Bailout! 53 54=head1 DESCRIPTION 55 56The bailout event is generated when things go horribly wrong and you need to 57halt 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 69Inherits from L<Test2::Event>. Also defines: 70 71=over 4 72 73=item $reason = $e->reason 74 75The reason for the bailout. 76 77=back 78 79=head1 SOURCE 80 81The source code repository for Test2 can be found at 82F<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 102Copyright 2018 Chad Granum E<lt>exodist@cpan.orgE<gt>. 103 104This program is free software; you can redistribute it and/or 105modify it under the same terms as Perl itself. 106 107See F<http://dev.perl.org/licenses/> 108 109=cut 110