1package Test2::Event::Skip; 2use strict; 3use warnings; 4 5our $VERSION = '1.302162'; 6 7 8BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } 9use Test2::Util::HashBase qw{reason}; 10 11sub init { 12 my $self = shift; 13 $self->SUPER::init; 14 $self->{+EFFECTIVE_PASS} = 1; 15} 16 17sub causes_fail { 0 } 18 19sub summary { 20 my $self = shift; 21 my $out = $self->SUPER::summary(@_); 22 23 if (my $reason = $self->reason) { 24 $out .= " (SKIP: $reason)"; 25 } 26 else { 27 $out .= " (SKIP)"; 28 } 29 30 return $out; 31} 32 33sub extra_amnesty { 34 my $self = shift; 35 36 my @out; 37 38 push @out => { 39 tag => 'TODO', 40 details => $self->{+TODO}, 41 } if defined $self->{+TODO}; 42 43 push @out => { 44 tag => 'skip', 45 details => $self->{+REASON}, 46 inherited => 0, 47 }; 48 49 return @out; 50} 51 521; 53 54__END__ 55 56=pod 57 58=encoding UTF-8 59 60=head1 NAME 61 62Test2::Event::Skip - Skip event type 63 64=head1 DESCRIPTION 65 66Skip events bump test counts just like L<Test2::Event::Ok> events, but 67they can never fail. 68 69=head1 SYNOPSIS 70 71 use Test2::API qw/context/; 72 use Test2::Event::Skip; 73 74 my $ctx = context(); 75 my $event = $ctx->skip($name, $reason); 76 77or: 78 79 my $ctx = context(); 80 my $event = $ctx->send_event( 81 'Skip', 82 name => $name, 83 reason => $reason, 84 ); 85 86=head1 ACCESSORS 87 88=over 4 89 90=item $reason = $e->reason 91 92The original true/false value of whatever was passed into the event (but 93reduced down to 1 or 0). 94 95=back 96 97=head1 SOURCE 98 99The source code repository for Test2 can be found at 100F<http://github.com/Test-More/test-more/>. 101 102=head1 MAINTAINERS 103 104=over 4 105 106=item Chad Granum E<lt>exodist@cpan.orgE<gt> 107 108=back 109 110=head1 AUTHORS 111 112=over 4 113 114=item Chad Granum E<lt>exodist@cpan.orgE<gt> 115 116=back 117 118=head1 COPYRIGHT 119 120Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>. 121 122This program is free software; you can redistribute it and/or 123modify it under the same terms as Perl itself. 124 125See F<http://www.perl.com/perl/misc/Artistic.html> 126 127=cut 128