diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-11-01 17:35:01 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-11-01 17:35:01 +0000 |
commit | c59be0827018418e40637878369155d288da3cf2 (patch) | |
tree | 91175d5d312507d52d377a3d3506a326113d92f0 /cpan | |
parent | 93d7ac13d34e6b9246990d232910a98d65549808 (diff) | |
download | perl-c59be0827018418e40637878369155d288da3cf2.tar.gz |
Upgrade Test::Simple from version 1.302059 to 1.302062
Diffstat (limited to 'cpan')
49 files changed, 193 insertions, 53 deletions
diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm index d3febbc9d1..a10c19fdb7 100644 --- a/cpan/Test-Simple/lib/Test/Builder.pm +++ b/cpan/Test-Simple/lib/Test/Builder.pm @@ -4,7 +4,7 @@ use 5.006; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { if( $] < 5.008 ) { @@ -339,7 +339,7 @@ sub subtest { $st_ctx->diag('No tests run!'); } - $child->finalize($ok); + $child->finalize($st_ctx->trace); $ctx->release; @@ -1146,7 +1146,7 @@ BEGIN { my $ctx = $self->ctx; my $format = $ctx->hub->format; - unless ($format && $format->isa('Test2::Formatter::TAP') && $format->can($set)) { + unless ($format && $format->can($set)) { warn "The current formatter does not support '$method'" if $format; $ctx->release; return diff --git a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm index 8aa7e2c371..e4051a53a0 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm @@ -2,7 +2,7 @@ package Test::Builder::Formatter; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Formatter::TAP; our @ISA = qw(Test2::Formatter::TAP) } diff --git a/cpan/Test-Simple/lib/Test/Builder/Module.pm b/cpan/Test-Simple/lib/Test/Builder/Module.pm index fe35da62ea..0bf0b08f3c 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Module.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Module.pm @@ -7,7 +7,7 @@ use Test::Builder; require Exporter; our @ISA = qw(Exporter); -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; =head1 NAME diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm index 716d521ec9..680adf2b95 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Tester.pm @@ -1,7 +1,7 @@ package Test::Builder::Tester; use strict; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test::Builder; use Symbol; diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm index 4ab8670871..c67378bba4 100644 --- a/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm +++ b/cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm @@ -1,7 +1,7 @@ package Test::Builder::Tester::Color; use strict; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; require Test::Builder::Tester; diff --git a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm index 7da9339139..2ae26262d8 100644 --- a/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm +++ b/cpan/Test-Simple/lib/Test/Builder/TodoDiag.pm @@ -2,7 +2,7 @@ package Test::Builder::TodoDiag; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event::Diag; our @ISA = qw(Test2::Event::Diag) } diff --git a/cpan/Test-Simple/lib/Test/More.pm b/cpan/Test-Simple/lib/Test/More.pm index 623987757e..0a0bfbe498 100644 --- a/cpan/Test-Simple/lib/Test/More.pm +++ b/cpan/Test-Simple/lib/Test/More.pm @@ -17,7 +17,7 @@ sub _carp { return warn @_, " at $file line $line\n"; } -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); diff --git a/cpan/Test-Simple/lib/Test/Simple.pm b/cpan/Test-Simple/lib/Test/Simple.pm index b0261f8793..3910d3c7e5 100644 --- a/cpan/Test-Simple/lib/Test/Simple.pm +++ b/cpan/Test-Simple/lib/Test/Simple.pm @@ -4,7 +4,7 @@ use 5.006; use strict; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); diff --git a/cpan/Test-Simple/lib/Test/Tester.pm b/cpan/Test-Simple/lib/Test/Tester.pm index 96c42e1f74..18f377cb5d 100644 --- a/cpan/Test-Simple/lib/Test/Tester.pm +++ b/cpan/Test-Simple/lib/Test/Tester.pm @@ -18,7 +18,7 @@ require Exporter; use vars qw( @ISA @EXPORT ); -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; @EXPORT = qw( run_tests check_tests check_test cmp_results show_space ); @ISA = qw( Exporter ); diff --git a/cpan/Test-Simple/lib/Test/Tester/Capture.pm b/cpan/Test-Simple/lib/Test/Tester/Capture.pm index eeb0d2aabd..d02230f9d0 100644 --- a/cpan/Test-Simple/lib/Test/Tester/Capture.pm +++ b/cpan/Test-Simple/lib/Test/Tester/Capture.pm @@ -2,7 +2,7 @@ use strict; package Test::Tester::Capture; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test::Builder; diff --git a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm index d768b9bd82..ae03fcfc66 100644 --- a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm +++ b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm @@ -3,7 +3,7 @@ use strict; package Test::Tester::CaptureRunner; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test::Tester::Capture; diff --git a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm index 91cee4c23c..e043092f39 100644 --- a/cpan/Test-Simple/lib/Test/Tester/Delegate.pm +++ b/cpan/Test-Simple/lib/Test/Tester/Delegate.pm @@ -3,7 +3,7 @@ use warnings; package Test::Tester::Delegate; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use vars '$AUTOLOAD'; diff --git a/cpan/Test-Simple/lib/Test/use/ok.pm b/cpan/Test-Simple/lib/Test/use/ok.pm index 5d0591fafa..a56f2d18e2 100644 --- a/cpan/Test-Simple/lib/Test/use/ok.pm +++ b/cpan/Test-Simple/lib/Test/use/ok.pm @@ -1,7 +1,7 @@ package Test::use::ok; use 5.005; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; __END__ diff --git a/cpan/Test-Simple/lib/Test2.pm b/cpan/Test-Simple/lib/Test2.pm index 29f8411e64..7f365e18c0 100644 --- a/cpan/Test-Simple/lib/Test2.pm +++ b/cpan/Test-Simple/lib/Test2.pm @@ -2,7 +2,7 @@ package Test2; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; 1; diff --git a/cpan/Test-Simple/lib/Test2/API.pm b/cpan/Test-Simple/lib/Test2/API.pm index ba25944c66..98bcb1f9c2 100644 --- a/cpan/Test-Simple/lib/Test2/API.pm +++ b/cpan/Test-Simple/lib/Test2/API.pm @@ -2,7 +2,7 @@ package Test2::API; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; my $INST; diff --git a/cpan/Test-Simple/lib/Test2/API/Breakage.pm b/cpan/Test-Simple/lib/Test2/API/Breakage.pm index 7b21ccadc1..8667d853f9 100644 --- a/cpan/Test-Simple/lib/Test2/API/Breakage.pm +++ b/cpan/Test-Simple/lib/Test2/API/Breakage.pm @@ -2,7 +2,7 @@ package Test2::API::Breakage; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Util qw/pkg_to_file/; diff --git a/cpan/Test-Simple/lib/Test2/API/Context.pm b/cpan/Test-Simple/lib/Test2/API/Context.pm index c4e1ece69e..27da02a2a0 100644 --- a/cpan/Test-Simple/lib/Test2/API/Context.pm +++ b/cpan/Test-Simple/lib/Test2/API/Context.pm @@ -2,7 +2,7 @@ package Test2::API::Context; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Carp qw/confess croak longmess/; diff --git a/cpan/Test-Simple/lib/Test2/API/Instance.pm b/cpan/Test-Simple/lib/Test2/API/Instance.pm index 556cad1f4b..567d54c8f5 100644 --- a/cpan/Test-Simple/lib/Test2/API/Instance.pm +++ b/cpan/Test-Simple/lib/Test2/API/Instance.pm @@ -2,7 +2,7 @@ package Test2::API::Instance; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; our @CARP_NOT = qw/Test2::API Test2::API::Instance Test2::IPC::Driver Test2::Formatter/; diff --git a/cpan/Test-Simple/lib/Test2/API/Stack.pm b/cpan/Test-Simple/lib/Test2/API/Stack.pm index 6db9f57fe8..438f6c02aa 100644 --- a/cpan/Test-Simple/lib/Test2/API/Stack.pm +++ b/cpan/Test-Simple/lib/Test2/API/Stack.pm @@ -2,7 +2,7 @@ package Test2::API::Stack; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Hub(); diff --git a/cpan/Test-Simple/lib/Test2/Event.pm b/cpan/Test-Simple/lib/Test2/Event.pm index a0aa61923c..dedf7c245f 100644 --- a/cpan/Test-Simple/lib/Test2/Event.pm +++ b/cpan/Test-Simple/lib/Test2/Event.pm @@ -2,7 +2,7 @@ package Test2::Event; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Util::HashBase qw/trace nested in_subtest subtest_id/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Bail.pm b/cpan/Test-Simple/lib/Test2/Event/Bail.pm index 06c94ce951..f1fdb2b92e 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Bail.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Bail.pm @@ -2,7 +2,7 @@ package Test2::Event::Bail; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Diag.pm b/cpan/Test-Simple/lib/Test2/Event/Diag.pm index 08b8621b1b..af2e0b5bba 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Diag.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Diag.pm @@ -2,7 +2,7 @@ package Test2::Event::Diag; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Exception.pm b/cpan/Test-Simple/lib/Test2/Event/Exception.pm index 4f7c7c59ca..50504947d4 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Exception.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Exception.pm @@ -2,7 +2,7 @@ package Test2::Event::Exception; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Generic.pm b/cpan/Test-Simple/lib/Test2/Event/Generic.pm index ff47ced6b1..0ae200e4f1 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Generic.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Generic.pm @@ -5,7 +5,7 @@ use warnings; use Carp qw/croak/; use Scalar::Util qw/reftype/; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase; diff --git a/cpan/Test-Simple/lib/Test2/Event/Info.pm b/cpan/Test-Simple/lib/Test2/Event/Info.pm index 7b1db5f4b3..f78fa35876 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Info.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Info.pm @@ -4,7 +4,7 @@ use warnings; use Scalar::Util qw/blessed/; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase qw/diagnostics renderer/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Note.pm b/cpan/Test-Simple/lib/Test2/Event/Note.pm index d0df97d729..bff3c7b0a6 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Note.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Note.pm @@ -2,7 +2,7 @@ package Test2::Event::Note; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Ok.pm b/cpan/Test-Simple/lib/Test2/Event/Ok.pm index d0cf32f6bb..b372fd192a 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Ok.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Ok.pm @@ -2,7 +2,7 @@ package Test2::Event::Ok; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Plan.pm b/cpan/Test-Simple/lib/Test2/Event/Plan.pm index 1986f595a7..2ce3315a2d 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Plan.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Plan.pm @@ -2,7 +2,7 @@ package Test2::Event::Plan; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Skip.pm b/cpan/Test-Simple/lib/Test2/Event/Skip.pm index dedb06d80f..7d5c3d9dd6 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Skip.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Skip.pm @@ -2,7 +2,7 @@ package Test2::Event::Skip; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm index f0b026e9e2..4792280e06 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Subtest.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Event::Subtest; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm index 2baa533bb5..304af72f59 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm @@ -2,7 +2,7 @@ package Test2::Event::Waiting; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Formatter.pm b/cpan/Test-Simple/lib/Test2/Formatter.pm index f3536c8661..d00559471c 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter.pm @@ -2,7 +2,7 @@ package Test2::Formatter; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; my %ADDED; @@ -16,6 +16,10 @@ sub import { sub hide_buffered { 1 } +sub terminate { } + +sub finalize { } + 1; __END__ @@ -48,6 +52,10 @@ A formatter is any package or object with a C<write($event, $num)> method. sub hide_buffered { 1 } + sub terminate { } + + sub finalize { } + 1; The C<write> method is a method, so it either gets a class or instance. The two @@ -60,6 +68,32 @@ The C<hide_buffered()> method must return a boolean. This is used to tell buffered subtests whether or not to send it events as they are being buffered. See L<Test2::API/"run_subtest(...)"> for more information. +The C<terminate> and C<finalize> methods are optional methods called that you +can implement if the format you're generating needs to handle these cases, for +example if you are generating XML and need close open tags. + +The C<terminate> method is called when an event's C<terminate> method returns +true, for example when a L<Test2::Event::Plan> has a C<'skip_all'> plan, or +when a L<Test2::Event::Bail> event is sent. The C<terminate> method is passed +a single argument, the L<Test2::Event> object which triggered the terminate. + +The C<finalize> method is always the last thing called on the formatter, I<< +except when C<terminate> is called for a Bail event >>. It is passed the +following arguments: + +=over 4 + +=item * The number of tests that were planned + +=item * The number of tests actually seen + +=item * The number of tests which failed + +=item * A boolean indicating whether or not the test suite passed + +=item * A boolean indicating whether or not this call is for a subtest + +=back =head1 SOURCE diff --git a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm index 93f53f0d62..3c2cce8d3c 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm @@ -3,7 +3,7 @@ use strict; use warnings; require PerlIO; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Util::HashBase qw{ diff --git a/cpan/Test-Simple/lib/Test2/Hub.pm b/cpan/Test-Simple/lib/Test2/Hub.pm index edc873bc1a..d15912dc4b 100644 --- a/cpan/Test-Simple/lib/Test2/Hub.pm +++ b/cpan/Test-Simple/lib/Test2/Hub.pm @@ -2,7 +2,7 @@ package Test2::Hub; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Carp qw/carp croak confess/; @@ -54,6 +54,8 @@ sub init { } } +sub is_subtest { 0 } + sub reset_state { my $self = shift; @@ -300,7 +302,10 @@ sub process { return $e if $is_ok || $no_fail; my $code = $e->terminate; - $self->terminate($code, $e) if defined $code; + if (defined $code) { + $self->{+_FORMATTER}->terminate($e) if $self->{+_FORMATTER}; + $self->terminate($code, $e); + } return $e; } @@ -332,8 +337,11 @@ sub finalize { my $failed = $self->{+FAILED}; my $active = $self->{+ACTIVE}; - # return if NOTHING was done. - return unless $active || $do_plan || defined($plan) || $count || $failed; + # return if NOTHING was done. + unless ($active || $do_plan || defined($plan) || $count || $failed) { + $self->{+_FORMATTER}->finalize($plan, $count, $failed, 0, $self->is_subtest) if $self->{+_FORMATTER}; + return; + } unless ($self->{+ENDED}) { if ($self->{+_FOLLOW_UPS}) { @@ -369,7 +377,11 @@ Second End: $sfile line $sline } $self->{+ENDED} = $frame; - $self->is_passing(); # Generate the final boolean. + my $pass = $self->is_passing(); # Generate the final boolean. + + $self->{+_FORMATTER}->finalize($plan, $count, $failed, $pass, $self->is_subtest) if $self->{+_FORMATTER}; + + return $pass; } sub is_passing { diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm index 31bdd14d00..5d211d20a8 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Hub::Interceptor::Terminator(); diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm index 95fb1f12f6..bbfa98370b 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Interceptor/Terminator.pm @@ -2,7 +2,7 @@ package Test2::Hub::Interceptor::Terminator; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; 1; diff --git a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm index 88b079a500..2da696896f 100644 --- a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm +++ b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm @@ -2,7 +2,7 @@ package Test2::Hub::Subtest; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } @@ -16,6 +16,8 @@ sub init { $self->{+ID} ||= join "-", $$, get_tid, $ID++; } +sub is_subtest { 1 } + sub process { my $self = shift; my ($e) = @_; diff --git a/cpan/Test-Simple/lib/Test2/IPC.pm b/cpan/Test-Simple/lib/Test2/IPC.pm index 620f1f8314..5c034e3ad4 100644 --- a/cpan/Test-Simple/lib/Test2/IPC.pm +++ b/cpan/Test-Simple/lib/Test2/IPC.pm @@ -2,7 +2,7 @@ package Test2::IPC; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::API::Instance; diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm index 6e9d0c3fc3..32d1333dca 100644 --- a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm +++ b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm @@ -2,7 +2,7 @@ package Test2::IPC::Driver; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Carp qw/confess longmess/; diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm index 5fddaca3fb..696bda9242 100644 --- a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm +++ b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm @@ -2,7 +2,7 @@ package Test2::IPC::Driver::Files; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) } diff --git a/cpan/Test-Simple/lib/Test2/Util.pm b/cpan/Test-Simple/lib/Test2/Util.pm index 9b810c6af1..070c574469 100644 --- a/cpan/Test-Simple/lib/Test2/Util.pm +++ b/cpan/Test-Simple/lib/Test2/Util.pm @@ -2,7 +2,7 @@ package Test2::Util; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Config qw/%Config/; diff --git a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm index e99b360dac..0d73fbeecd 100644 --- a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm +++ b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm @@ -2,7 +2,7 @@ package Test2::Util::ExternalMeta; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm index 6594c52e71..0a40191ad0 100644 --- a/cpan/Test-Simple/lib/Test2/Util/HashBase.pm +++ b/cpan/Test-Simple/lib/Test2/Util/HashBase.pm @@ -2,7 +2,7 @@ package Test2::Util::HashBase; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; require Carp; diff --git a/cpan/Test-Simple/lib/Test2/Util/Trace.pm b/cpan/Test-Simple/lib/Test2/Util/Trace.pm index 189fe5f8b6..34be24f6d6 100644 --- a/cpan/Test-Simple/lib/Test2/Util/Trace.pm +++ b/cpan/Test-Simple/lib/Test2/Util/Trace.pm @@ -2,7 +2,7 @@ package Test2::Util::Trace; use strict; use warnings; -our $VERSION = '1.302059'; +our $VERSION = '1.302062'; use Test2::Util qw/get_tid/; diff --git a/cpan/Test-Simple/lib/ok.pm b/cpan/Test-Simple/lib/ok.pm index 4a42d7570f..4c5f9d139a 100644 --- a/cpan/Test-Simple/lib/ok.pm +++ b/cpan/Test-Simple/lib/ok.pm @@ -1,5 +1,5 @@ package ok; -$ok::VERSION = '1.302059'; +$ok::VERSION = '1.302062'; use strict; use Test::More (); diff --git a/cpan/Test-Simple/t/Legacy/missing.t b/cpan/Test-Simple/t/Legacy/missing.t index 3996b6de4b..3b8f1fa9b4 100644 --- a/cpan/Test-Simple/t/Legacy/missing.t +++ b/cpan/Test-Simple/t/Legacy/missing.t @@ -1,3 +1,4 @@ +# HARNESS-NO-PRELOAD BEGIN { if( $ENV{PERL_CORE} ) { chdir 't'; diff --git a/cpan/Test-Simple/t/Test2/behavior/Formatter.t b/cpan/Test-Simple/t/Test2/behavior/Formatter.t new file mode 100644 index 0000000000..01eebc614e --- /dev/null +++ b/cpan/Test-Simple/t/Test2/behavior/Formatter.t @@ -0,0 +1,84 @@ +use strict; +use warnings; + +BEGIN { require "t/tools.pl" } + +use Test2::API qw/intercept run_subtest test2_stack/; +use Test2::Event::Bail; + +{ + + package Formatter::Subclass; + use parent 'Test2::Formatter'; + use Test2::Util::HashBase qw{f t}; + + sub init { + my $self = shift; + $self->{+F} = []; + $self->{+T} = []; + } + + sub write { } + sub hide_buffered { 1 } + + sub terminate { + my $s = shift; + push @{$s->{+T}}, [@_]; + } + + sub finalize { + my $s = shift; + push @{$s->{+F}}, [@_]; + } +} + +{ + my $f = Formatter::Subclass->new; + intercept { + my $hub = test2_stack->top; + $hub->format($f); + is(1, 1, 'test event 1'); + is(2, 2, 'test event 2'); + is(3, 2, 'test event 3'); + done_testing; + }; + + is(scalar @{$f->f}, 1, 'finalize method was called on formatter'); + is_deeply( + $f->f->[0], + [3, 3, 1, 0, 0], + 'finalize method received expected arguments' + ); + + ok(!@{$f->t}, 'terminate method was not called on formatter'); +} + +{ + my $f = Formatter::Subclass->new; + + intercept { + my $hub = test2_stack->top; + $hub->format($f); + $hub->send(Test2::Event::Bail->new(reason => 'everything is terrible')); + done_testing; + }; + + is(scalar @{$f->t}, 1, 'terminate method was called because of bail event'); + ok(!@{$f->f}, 'finalize method was not called on formatter'); +} + +{ + my $f = Formatter::Subclass->new; + + intercept { + my $hub = test2_stack->top; + $hub->format($f); + $hub->send(Test2::Event::Plan->new(directive => 'skip_all', reason => 'Skipping all the tests')); + done_testing; + }; + + is(scalar @{$f->t}, 1, 'terminate method was called because of plan skip_all event'); + ok(!@{$f->f}, 'finalize method was not called on formatter'); +} + +done_testing; diff --git a/cpan/Test-Simple/t/Test2/behavior/Subtest_buffer_formatter.t b/cpan/Test-Simple/t/Test2/behavior/Subtest_buffer_formatter.t index 6aa0ffb6b3..2fc58ef5f0 100644 --- a/cpan/Test-Simple/t/Test2/behavior/Subtest_buffer_formatter.t +++ b/cpan/Test-Simple/t/Test2/behavior/Subtest_buffer_formatter.t @@ -8,14 +8,20 @@ use Test2::API qw/run_subtest intercept test2_stack/; { package Formatter::Hide; sub write { } - sub hide_buffered { 1 }; + sub hide_buffered { 1 } + sub terminate { } + sub finalize { } package Formatter::Show; sub write { } - sub hide_buffered { 0 }; + sub hide_buffered { 0 } + sub terminate { } + sub finalize { } package Formatter::NA; sub write { } + sub terminate { } + sub finalize { } } my %HAS_FORMATTER; diff --git a/cpan/Test-Simple/t/Test2/behavior/no_load_api.t b/cpan/Test-Simple/t/Test2/behavior/no_load_api.t index eab0da82ae..8bf54c95f7 100644 --- a/cpan/Test-Simple/t/Test2/behavior/no_load_api.t +++ b/cpan/Test-Simple/t/Test2/behavior/no_load_api.t @@ -1,3 +1,4 @@ +# HARNESS-NO-PRELOAD use strict; use warnings; use Data::Dumper; |