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