diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2017-10-03 08:12:02 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2017-10-03 08:58:26 +0100 |
commit | 95db2efbae5edc9942892a1153e1db8056d6ca06 (patch) | |
tree | 453ddcc354a89092800b1a43342b3c3cad96f0be /cpan/Test-Simple | |
parent | 07bc328a0524ea51d473545282321341bcd61e03 (diff) | |
download | perl-95db2efbae5edc9942892a1153e1db8056d6ca06.tar.gz |
Upgrade Test-Simple from version 1.302096 to 1.302097
Diffstat (limited to 'cpan/Test-Simple')
79 files changed, 302 insertions, 88 deletions
diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm index e2a0caa686..48cc04293e 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.302096'; +our $VERSION = '1.302097'; BEGIN { if( $] < 5.008 ) { @@ -336,7 +336,7 @@ sub subtest { } } - if ($start_pid != $$ && !$INC{'Test/Sync/IPC.pm'}) { + if ($start_pid != $$ && !$INC{'Test2/IPC.pm'}) { warn $ok ? "Forked inside subtest, but subtest never finished!\n" : $err; exit 255; } @@ -1439,7 +1439,7 @@ sub summary { my $ctx = $self->ctx; my $data = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results}; $ctx->release; - return map { $_->{'ok'} } @$data; + return map { $_ ? $_->{'ok'} : () } @$data; } diff --git a/cpan/Test-Simple/lib/Test/Builder/Formatter.pm b/cpan/Test-Simple/lib/Test/Builder/Formatter.pm index 44b7cd43ea..6b41d7d6b9 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.302096'; +our $VERSION = '1.302097'; 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 1114ec9bb5..857abfdf64 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.302096'; +our $VERSION = '1.302097'; =head1 NAME diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm index 00dc38dd66..7e551f7c01 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.302096'; +our $VERSION = '1.302097'; 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 a3f1f708ae..8a7b73a14a 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.302096'; +our $VERSION = '1.302097'; 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 8c02d73834..da60fba266 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.302096'; +our $VERSION = '1.302097'; 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 4c08fea63f..506639b48b 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.302096'; +our $VERSION = '1.302097'; 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 16a657489e..0882f175a5 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.302096'; +our $VERSION = '1.302097'; 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 b8dde127df..786ae240dd 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.302096'; +our $VERSION = '1.302097'; @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 e6965fc69b..c4e3d00243 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.302096'; +our $VERSION = '1.302097'; use Test::Builder; diff --git a/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm b/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm index 18c17f7a14..65e2e8c63f 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.302096'; +our $VERSION = '1.302097'; 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 8e87ca6254..71b383be0b 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.302096'; +our $VERSION = '1.302097'; use Scalar::Util(); diff --git a/cpan/Test-Simple/lib/Test/use/ok.pm b/cpan/Test-Simple/lib/Test/use/ok.pm index 042996bf08..30275e9a5d 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.302096'; +our $VERSION = '1.302097'; __END__ diff --git a/cpan/Test-Simple/lib/Test2.pm b/cpan/Test-Simple/lib/Test2.pm index 61eee99d57..65578b1f89 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.302096'; +our $VERSION = '1.302097'; 1; diff --git a/cpan/Test-Simple/lib/Test2/API.pm b/cpan/Test-Simple/lib/Test2/API.pm index e43a0d6c57..199e3b082c 100644 --- a/cpan/Test-Simple/lib/Test2/API.pm +++ b/cpan/Test-Simple/lib/Test2/API.pm @@ -9,7 +9,7 @@ BEGIN { $ENV{TEST2_ACTIVE} = 1; } -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; my $INST; @@ -68,7 +68,7 @@ use Test2::Event::Waiting(); use Test2::Event::Skip(); use Test2::Event::Subtest(); -use Carp qw/carp croak confess longmess/; +use Carp qw/carp croak confess/; use Scalar::Util qw/blessed weaken/; use Test2::Util qw/get_tid clone_io pkg_to_file/; @@ -267,7 +267,7 @@ my $CID = 1; sub context { # We need to grab these before anything else to ensure they are not # changed. - my ($errno, $eval_error, $child_error) = (0 + $!, $@, $?); + my ($errno, $eval_error, $child_error, $extended_error) = (0 + $!, $@, $?, $^E); my %params = (level => 0, wrapped => 0, @_); @@ -309,7 +309,7 @@ sub context { } # I know this is ugly.... - ($!, $@, $?) = ($errno, $eval_error, $child_error) and return bless( + ($!, $@, $?, $^E) = ($errno, $eval_error, $child_error, $extended_error) and return bless( { %$current, _is_canon => undef, @@ -378,7 +378,7 @@ sub context { $params{on_init}->($current) if $params{on_init}; - ($!, $@, $?) = ($errno, $eval_error, $child_error); + ($!, $@, $?, $^E) = ($errno, $eval_error, $child_error, $extended_error); return $current; } @@ -406,7 +406,8 @@ sub _existing_error { my $oldframe = $ctx->{trace}->frame; my $olddepth = $ctx->{_depth}; - my $mess = longmess(); + # Older versions of Carp do not export longmess() function, so it needs to be called with package name + my $mess = Carp::longmess(); warn <<" EOT"; $msg @@ -524,7 +525,6 @@ sub run_subtest { my $stack = $ctx->stack || $STACK; my $hub = $stack->new_hub( class => 'Test2::Hub::Subtest', - buffered => $buffered, %$params, buffered => $buffered, ); diff --git a/cpan/Test-Simple/lib/Test2/API/Breakage.pm b/cpan/Test-Simple/lib/Test2/API/Breakage.pm index f97984f129..9414df7127 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.302096'; +our $VERSION = '1.302097'; 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 db803c03c6..c5486e8921 100644 --- a/cpan/Test-Simple/lib/Test2/API/Context.pm +++ b/cpan/Test-Simple/lib/Test2/API/Context.pm @@ -2,10 +2,10 @@ package Test2::API::Context; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; -use Carp qw/confess croak longmess/; +use Carp qw/confess croak/; use Scalar::Util qw/weaken blessed/; use Test2::Util qw/get_tid try pkg_to_file get_tid/; diff --git a/cpan/Test-Simple/lib/Test2/API/Instance.pm b/cpan/Test-Simple/lib/Test2/API/Instance.pm index c9714581bf..e946d035f9 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.302096'; +our $VERSION = '1.302097'; 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 d38563dcc8..a0d46d5ea5 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.302096'; +our $VERSION = '1.302097'; use Test2::Hub(); diff --git a/cpan/Test-Simple/lib/Test2/Event.pm b/cpan/Test-Simple/lib/Test2/Event.pm index f7be152ebd..2245550cfc 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.302096'; +our $VERSION = '1.302097'; use Test2::Util::HashBase qw/trace -amnesty/; use Test2::Util::ExternalMeta qw/meta get_meta set_meta delete_meta/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Bail.pm b/cpan/Test-Simple/lib/Test2/Event/Bail.pm index bd1dda90fa..b9b35391c9 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.302096'; +our $VERSION = '1.302097'; 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 974a2038e1..3ebffd17e3 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Encoding.pm b/cpan/Test-Simple/lib/Test2/Event/Encoding.pm index 78f8aa2f01..597d929dd8 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Encoding.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Encoding.pm @@ -2,7 +2,7 @@ package Test2::Event::Encoding; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Exception.pm b/cpan/Test-Simple/lib/Test2/Event/Exception.pm index 4ef3916736..67c757a3c4 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Exception.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Exception.pm @@ -2,12 +2,17 @@ package Test2::Event::Exception; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase qw{error}; +sub init { + my $self = shift; + $self->{+ERROR} = "$self->{+ERROR}"; +} + sub causes_fail { 1 } sub summary { @@ -71,6 +76,10 @@ The reason for the exception. =back +=head1 CAVEATS + +Be aware that all exceptions are stringified during construction. + =head1 SOURCE The source code repository for Test2 can be found at diff --git a/cpan/Test-Simple/lib/Test2/Event/Fail.pm b/cpan/Test-Simple/lib/Test2/Event/Fail.pm index f298bc5d93..de34f4b33f 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Fail.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Fail.pm @@ -2,7 +2,7 @@ package Test2::Event::Fail; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Test2::EventFacet::Info; diff --git a/cpan/Test-Simple/lib/Test2/Event/Generic.pm b/cpan/Test-Simple/lib/Test2/Event/Generic.pm index 04611a651c..e92a9f684e 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } use Test2::Util::HashBase; diff --git a/cpan/Test-Simple/lib/Test2/Event/Note.pm b/cpan/Test-Simple/lib/Test2/Event/Note.pm index 35e4be7a13..f086ad21aa 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.302096'; +our $VERSION = '1.302097'; 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 5cc02d24fe..932bd710e5 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/Event/Pass.pm b/cpan/Test-Simple/lib/Test2/Event/Pass.pm index a3e91e4f14..c31bba85f5 100644 --- a/cpan/Test-Simple/lib/Test2/Event/Pass.pm +++ b/cpan/Test-Simple/lib/Test2/Event/Pass.pm @@ -2,7 +2,7 @@ package Test2::Event::Pass; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Test2::EventFacet::Info; diff --git a/cpan/Test-Simple/lib/Test2/Event/Plan.pm b/cpan/Test-Simple/lib/Test2/Event/Plan.pm index 3a647a5db4..78ef5c450b 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.302096'; +our $VERSION = '1.302097'; 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 69c57192dc..95ea922787 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.302096'; +our $VERSION = '1.302097'; 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 56c4c0735f..00afbf7940 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } use Test2::Util::HashBase qw{subevents buffered subtest_id}; diff --git a/cpan/Test-Simple/lib/Test2/Event/TAP/Version.pm b/cpan/Test-Simple/lib/Test2/Event/TAP/Version.pm index bd539f99e5..67bb6374ed 100644 --- a/cpan/Test-Simple/lib/Test2/Event/TAP/Version.pm +++ b/cpan/Test-Simple/lib/Test2/Event/TAP/Version.pm @@ -2,7 +2,7 @@ package Test2::Event::TAP::Version; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/Event/Waiting.pm b/cpan/Test-Simple/lib/Test2/Event/Waiting.pm index bdf8fdeded..d700c7f06f 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } diff --git a/cpan/Test-Simple/lib/Test2/EventFacet.pm b/cpan/Test-Simple/lib/Test2/EventFacet.pm index 794c454058..bed1306d52 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet.pm @@ -2,7 +2,7 @@ package Test2::EventFacet; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Test2::Util::HashBase qw/-details/; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/About.pm b/cpan/Test-Simple/lib/Test2/EventFacet/About.pm index 58000d3027..f34560dc1f 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/About.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/About.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::About; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -package -no_display }; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Amnesty.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Amnesty.pm index 409a9e35c8..f44050c05e 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Amnesty.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Amnesty.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Amnesty; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; sub is_list { 1 } diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Assert.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Assert.pm index d42677f5f3..00ecd75c63 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Assert.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Assert.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Assert; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -pass -no_debug -number }; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Control.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Control.pm index 79f2f89d61..babe0fe1ec 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Control.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Control.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Control; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -global -terminate -halt -has_callback -encoding }; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Error.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Error.pm index 2f9f9d7b36..b7eec24026 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Error.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Error.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Error; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; sub facet_key { 'errors' } sub is_list { 1 } diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Info.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Info.pm index a7fac912e4..8c5dd91916 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Info.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Info.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Info; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; sub is_list { 1 } diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Meta.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Meta.pm index bab0631599..0550641093 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Meta.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Meta.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Meta; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use vars qw/$AUTOLOAD/; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Parent.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Parent.pm index 5718e171d6..b97e5ec3ef 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Parent.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Parent.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Parent; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Carp qw/confess/; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Plan.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Plan.pm index 1584efb443..7ab6682c17 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Plan.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Plan.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Plan; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } use Test2::Util::HashBase qw{ -count -skip -none }; diff --git a/cpan/Test-Simple/lib/Test2/EventFacet/Trace.pm b/cpan/Test-Simple/lib/Test2/EventFacet/Trace.pm index 6f933173b8..e9ed106c4a 100644 --- a/cpan/Test-Simple/lib/Test2/EventFacet/Trace.pm +++ b/cpan/Test-Simple/lib/Test2/EventFacet/Trace.pm @@ -2,7 +2,7 @@ package Test2::EventFacet::Trace; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::EventFacet; our @ISA = qw(Test2::EventFacet) } diff --git a/cpan/Test-Simple/lib/Test2/Formatter.pm b/cpan/Test-Simple/lib/Test2/Formatter.pm index cd1a784ac3..56c68a5f81 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.302096'; +our $VERSION = '1.302097'; my %ADDED; @@ -72,7 +72,7 @@ A formatter is any package or object with a C<write($event, $num)> method. The C<write> method is a method, so it either gets a class or instance. The two arguments are the C<$event> object it should record, and the C<$assert_num> which is the number of the current assertion (ok), or the last assertion if -this even is not itself an assertion. The assertion number may be any integer 0 +this event is not itself an assertion. The assertion number may be any integer 0 or greater, and may be undefined in some cases. The C<hide_buffered()> method must return a boolean. This is used to tell diff --git a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm index d2dbc649f1..524099e01a 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm @@ -2,7 +2,7 @@ package Test2::Formatter::TAP; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Test2::Util qw/clone_io/; @@ -53,7 +53,7 @@ sub _open_handles { sub encoding { my $self = shift; - if (@_) { + if ($] ge "5.007003" and @_) { my ($enc) = @_; my $handles = $self->{+HANDLES}; diff --git a/cpan/Test-Simple/lib/Test2/Hub.pm b/cpan/Test-Simple/lib/Test2/Hub.pm index 9169f0bb6c..a3cc7c2fbb 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.302096'; +our $VERSION = '1.302097'; use Carp qw/carp croak confess/; @@ -320,7 +320,7 @@ sub process { my $fail = 0; $fail = 1 if $f->{assert} && !$f->{assert}->{pass}; - $fail = 1 if $f->{error} && $f->{error}->{fail}; + $fail = 1 if $f->{errors} && grep { $_->{fail} } @{$f->{errors}}; $fail = 0 if $f->{amnesty}; $self->{+COUNT}++ if $f->{assert}; diff --git a/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm b/cpan/Test-Simple/lib/Test2/Hub/Interceptor.pm index efeb09f6c1..56539a524f 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.302096'; +our $VERSION = '1.302097'; 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 51d5040272..c61ac37410 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.302096'; +our $VERSION = '1.302097'; 1; diff --git a/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm b/cpan/Test-Simple/lib/Test2/Hub/Subtest.pm index aa0a939299..4e052f2fb2 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } use Test2::Util::HashBase qw/nested exit_code manual_skip_all/; diff --git a/cpan/Test-Simple/lib/Test2/IPC.pm b/cpan/Test-Simple/lib/Test2/IPC.pm index c6f872ead5..e6bf0f5a68 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.302096'; +our $VERSION = '1.302097'; 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 7f3e10b0bf..112a85d20d 100644 --- a/cpan/Test-Simple/lib/Test2/IPC/Driver.pm +++ b/cpan/Test-Simple/lib/Test2/IPC/Driver.pm @@ -2,10 +2,10 @@ package Test2::IPC::Driver; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; -use Carp qw/confess longmess/; +use Carp qw/confess/; use Test2::Util::HashBase qw{no_fatal}; use Test2::API qw/test2_ipc_add_driver/; @@ -45,7 +45,8 @@ sub abort { sub abort_trace { my $self = shift; my ($msg) = @_; - $self->abort(longmess($msg)); + # Older versions of Carp do not export longmess() function, so it needs to be called with package name + $self->abort(Carp::longmess($msg)); } 1; diff --git a/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm b/cpan/Test-Simple/lib/Test2/IPC/Driver/Files.pm index c847966d7a..45bf94c53e 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.302096'; +our $VERSION = '1.302097'; BEGIN { require Test2::IPC::Driver; our @ISA = qw(Test2::IPC::Driver) } diff --git a/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm b/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm index c460196892..baa6a0368e 100644 --- a/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm +++ b/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm @@ -2,6 +2,12 @@ package Test2::Tools::Tiny; use strict; use warnings; +BEGIN { + if ($] lt "5.008") { + require Test::Builder::IO::Scalar; + } +} + use Scalar::Util qw/blessed/; use Test2::Util qw/try/; @@ -10,7 +16,7 @@ use Test2::API qw/context run_subtest test2_stack/; use Test2::Hub::Interceptor(); use Test2::Hub::Interceptor::Terminator(); -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; BEGIN { require Exporter; our @ISA = qw(Exporter) } our @EXPORT = qw{ @@ -253,8 +259,16 @@ sub capture(&) { my ($out_fh, $err_fh); ($ok, $e) = try { + # Scalar refs as filehandles were added in 5.8. + if ($] ge "5.008") { open($out_fh, '>', \$out) or die "Failed to open a temporary STDOUT: $!"; open($err_fh, '>', \$err) or die "Failed to open a temporary STDERR: $!"; + } + # Emulate scalar ref filehandles with a tie. + else { + $out_fh = Test::Builder::IO::Scalar->new(\$out) or die "Failed to open a temporary STDOUT"; + $err_fh = Test::Builder::IO::Scalar->new(\$err) or die "Failed to open a temporary STDERR"; + } test2_stack->top->format->set_handles([$out_fh, $err_fh, $out_fh]); diff --git a/cpan/Test-Simple/lib/Test2/Util.pm b/cpan/Test-Simple/lib/Test2/Util.pm index 51c7fc97b5..dcfbdfa50f 100644 --- a/cpan/Test-Simple/lib/Test2/Util.pm +++ b/cpan/Test-Simple/lib/Test2/Util.pm @@ -2,12 +2,16 @@ package Test2::Util; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use POSIX(); use Config qw/%Config/; use Carp qw/croak/; -use PerlIO(); + +BEGIN { + local ($@, $!, $SIG{__DIE__}); + *HAVE_PERLIO = eval { require PerlIO; PerlIO->VERSION(1.02); } ? sub() { 1 } : sub() { 0 }; +} our @EXPORT_OK = qw{ try @@ -25,7 +29,6 @@ our @EXPORT_OK = qw{ ipc_separator - clone_io do_rename do_unlink try_sig_mask @@ -175,14 +178,18 @@ my %PERLIO_SKIP = ( sub clone_io { my ($fh) = @_; - my $fileno = fileno($fh) or croak "Could not get fileno for handle"; + my $fileno = fileno($fh); + + return $fh if !defined($fileno) || !length($fileno) || $fileno < 0; + + open(my $out, '>&' . $fileno) or die "Can't dup fileno $fileno: $!"; my %seen; - open(my $out, '>&', $fileno) or die "Can't dup fileno $fileno: $!"; - binmode($out, join(":", "", "raw", grep { !$PERLIO_SKIP{$_} and !$seen{$_}++ } PerlIO::get_layers(STDOUT))); + my @layers = HAVE_PERLIO ? grep { !$PERLIO_SKIP{$_} and !$seen{$_}++ } PerlIO::get_layers($fh) : (); + binmode($out, join(":", "", "raw", @layers)); my $old = select $fh; - my $af = $|; + my $af = $|; select $out; $| = $af; select $old; diff --git a/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm b/cpan/Test-Simple/lib/Test2/Util/ExternalMeta.pm index b3f3884e6f..416dfefc36 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.302096'; +our $VERSION = '1.302097'; use Carp qw/croak/; diff --git a/cpan/Test-Simple/lib/Test2/Util/Facets2Legacy.pm b/cpan/Test-Simple/lib/Test2/Util/Facets2Legacy.pm index 5ee96e33cd..914d3c78ff 100644 --- a/cpan/Test-Simple/lib/Test2/Util/Facets2Legacy.pm +++ b/cpan/Test-Simple/lib/Test2/Util/Facets2Legacy.pm @@ -2,7 +2,7 @@ package Test2::Util::Facets2Legacy; use strict; use warnings; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use Carp qw/croak confess/; use Scalar::Util qw/blessed/; diff --git a/cpan/Test-Simple/lib/Test2/Util/Trace.pm b/cpan/Test-Simple/lib/Test2/Util/Trace.pm index 50c3405265..ae5392eb01 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; require Test2::EventFacet::Trace; @ISA = ('Test2::EventFacet::Trace'); -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; 1; diff --git a/cpan/Test-Simple/lib/ok.pm b/cpan/Test-Simple/lib/ok.pm index 04c38d8700..a3bef501b0 100644 --- a/cpan/Test-Simple/lib/ok.pm +++ b/cpan/Test-Simple/lib/ok.pm @@ -1,5 +1,5 @@ package ok; -our $VERSION = '1.302096'; +our $VERSION = '1.302097'; use strict; use Test::More (); diff --git a/cpan/Test-Simple/t/HashBase.t b/cpan/Test-Simple/t/HashBase.t index aa4d4358a8..397c69759f 100644 --- a/cpan/Test-Simple/t/HashBase.t +++ b/cpan/Test-Simple/t/HashBase.t @@ -83,7 +83,10 @@ is($pkg->do_it, 'const', "worked as expected"); *main::Const::Test::FOO = sub { 0 }; } ok(!$pkg->FOO, "overrode const sub"); +{ +local $TODO = "known to fail on $]" if $] le "5.006002"; is($pkg->do_it, 'const', "worked as expected, const was constant"); +} BEGIN { $INC{'Object/HashBase/Test/HBase/Wrapped.pm'} = __FILE__; diff --git a/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t b/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t index f9a64ee256..c94f7d4fcb 100644 --- a/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t +++ b/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t @@ -18,13 +18,19 @@ sub capture(&) { return $warn || ""; } +{ +local $TODO = "known to fail on $]" if $] le "5.006002"; my $file = __FILE__; -my $line = __LINE__ + 2; +my $line = __LINE__ + 4; like( - capture { use_ok 'MyWarner' }, + capture { + local $TODO; # localize $TODO to clear previous assignment, as following use_ok test is expected to pass + use_ok 'MyWarner'; + }, qr/^Deprected! run for your lives! at \Q$file\E line $line/, "Got the warning" ); +} ok(!capture { no warnings 'deprecated'; use_ok 'MyWarner' }, "No warning"); diff --git a/cpan/Test-Simple/t/Legacy/Regression/789-read-only.t b/cpan/Test-Simple/t/Legacy/Regression/789-read-only.t new file mode 100644 index 0000000000..120e3f9cf3 --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/Regression/789-read-only.t @@ -0,0 +1,37 @@ +use Test::More; +use strict; +use warnings; + +# See https://github.com/Test-More/test-more/issues/789 + +BEGIN { + plan skip_all => 'AUTHOR_TESTING not enabled' + unless $ENV{AUTHOR_TESTING}; + + plan skip_all => "This test requires Test::Class" + unless eval { require Test::Class; 1 }; + + plan skip_all => "This test requires Test::Script" + unless eval { require Test::Script; 1 }; +} + +package Test; + +use base 'Test::Class'; + +use Test::More; +use Test::Script; + +sub a_compilation_test : Test(startup => 1) { + script_compiles(__FILE__); +} + +sub test : Test(1) { + ok(1); +} + +package main; + +use Test::Class; + +Test::Class->runtests; diff --git a/cpan/Test-Simple/t/Legacy/harness_active.t b/cpan/Test-Simple/t/Legacy/harness_active.t index 7b027a7b40..4e0c558710 100644 --- a/cpan/Test-Simple/t/Legacy/harness_active.t +++ b/cpan/Test-Simple/t/Legacy/harness_active.t @@ -47,6 +47,7 @@ Test::More->builder->no_ending(1); { local $ENV{HARNESS_ACTIVE} = 0; + local $ENV{HARNESS_IS_VERBOSE} = 0; #line 62 fail( "this fails" ); @@ -66,6 +67,7 @@ ERR { local $ENV{HARNESS_ACTIVE} = 1; + local $ENV{HARNESS_IS_VERBOSE} = 0; #line 71 fail( "this fails" ); diff --git a/cpan/Test-Simple/t/Legacy/overload_threads.t b/cpan/Test-Simple/t/Legacy/overload_threads.t index 56bdaec5bc..fbc067aea1 100644 --- a/cpan/Test-Simple/t/Legacy/overload_threads.t +++ b/cpan/Test-Simple/t/Legacy/overload_threads.t @@ -18,7 +18,11 @@ BEGIN { eval { require threads; 'threads'->import; 1; } if CAN_THREAD; } -use Test::More tests => 5; +use Test::More; + +plan skip_all => "known to crash on $]" if $] le "5.006002"; + +plan tests => 5; package Overloaded; diff --git a/cpan/Test-Simple/t/Legacy/utf8.t b/cpan/Test-Simple/t/Legacy/utf8.t index 97e4cf4c4a..6e629d4335 100644 --- a/cpan/Test-Simple/t/Legacy/utf8.t +++ b/cpan/Test-Simple/t/Legacy/utf8.t @@ -17,6 +17,7 @@ BEGIN { # All together so Test::More sees the open discipline $have_perlio = eval q[ require PerlIO; + PerlIO->VERSION(1.02); # required for PerlIO::get_layers binmode *STDOUT, ":encoding(utf8)"; binmode *STDERR, ":encoding(utf8)"; require Test::More; @@ -30,7 +31,7 @@ unless (Test::Builder->new->{Stack}->top->format->isa('Test::Builder::Formatter' } if( !$have_perlio ) { - plan skip_all => "Don't have PerlIO"; + plan skip_all => "Don't have PerlIO 1.02"; } else { plan tests => 5; diff --git a/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t b/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t index b557230fdb..b5cf68be71 100644 --- a/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t +++ b/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t @@ -1,6 +1,11 @@ use strict; use warnings; +if ($] lt "5.008") { + print "1..0 # SKIP Test cannot run on perls below 5.8.0\n"; + exit 0; +} + BEGIN { require Test2::API; Test2::API::test2_start_preload(); diff --git a/cpan/Test-Simple/t/Test2/behavior/init_croak.t b/cpan/Test-Simple/t/Test2/behavior/init_croak.t index dc49283193..bebf410b82 100644 --- a/cpan/Test-Simple/t/Test2/behavior/init_croak.t +++ b/cpan/Test-Simple/t/Test2/behavior/init_croak.t @@ -14,6 +14,8 @@ BEGIN { } } +skip_all("known to fail on $]") if $] le "5.006002"; + $@ = ""; my ($file, $line) = (__FILE__, __LINE__ + 1); eval { my $one = Foo::Bar->new }; diff --git a/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t b/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t index 55db247f4a..0c79c8a854 100644 --- a/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t +++ b/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t @@ -5,6 +5,8 @@ use Test2::Tools::Tiny; use Test2::API qw/context/; +skip_all("known to fail on $]") if $] le "5.006002"; + sub outer { my $code = shift; my $ctx = context(); diff --git a/cpan/Test-Simple/t/Test2/modules/API.t b/cpan/Test-Simple/t/Test2/modules/API.t index 27790aa0ba..b709909720 100644 --- a/cpan/Test-Simple/t/Test2/modules/API.t +++ b/cpan/Test-Simple/t/Test2/modules/API.t @@ -102,11 +102,18 @@ is_deeply([$CLASS->can('test2_ipc_drivers')->()], [qw/Test2::IPC::Driver::Files/ my $file = __FILE__; my $line = __LINE__ + 1; my $warnings = warnings { $CLASS->can('test2_ipc_add_driver')->('fake') }; +my $sub1 = sub { like( $warnings->[0], qr{^IPC driver fake loaded too late to be used as the global ipc driver at \Q$file\E line $line}, "got warning about adding driver too late" ); +}; +if ($] le "5.006002") { + todo("TODO known to fail on $]", $sub1); +} else { + $sub1->(); +} is_deeply([$CLASS->can('test2_ipc_drivers')->()], [qw/fake Test2::IPC::Driver::Files/], "Got updated list"); diff --git a/cpan/Test-Simple/t/Test2/modules/API/Instance.t b/cpan/Test-Simple/t/Test2/modules/API/Instance.t index 124ae6e3a4..18b78e7af6 100644 --- a/cpan/Test-Simple/t/Test2/modules/API/Instance.t +++ b/cpan/Test-Simple/t/Test2/modules/API/Instance.t @@ -258,7 +258,8 @@ if (CAN_THREAD && $] ge '5.010') { like($events[0]->message, qr/Test ended with extra hubs on the stack!/, "got diag"); } -{ +SKIP: { + last SKIP if $] lt "5.008"; $one->reset; my $stderr = ""; { @@ -286,7 +287,8 @@ This is not a supported configuration, you will have problems. EOT } -{ +SKIP: { + last SKIP if $] lt "5.008"; require Test2::API::Breakage; no warnings qw/redefine once/; my $ran = 0; diff --git a/cpan/Test-Simple/t/Test2/modules/Event/Exception.t b/cpan/Test-Simple/t/Test2/modules/Event/Exception.t index 78c175878a..4d58aad7d7 100644 --- a/cpan/Test-Simple/t/Test2/modules/Event/Exception.t +++ b/cpan/Test-Simple/t/Test2/modules/Event/Exception.t @@ -27,4 +27,29 @@ is_deeply( "Got error facet", ); +my $hash = {an => 'error'}; +my $str = "$hash"; + +$exception = Test2::Event::Exception->new( + trace => {frame => []}, + error => $hash, +); + +ok($exception->causes_fail, "Exception events always cause failure"); + +is($exception->error, $str, "Got stringified exception"); + +$facet_data = $exception->facet_data; +ok($facet_data->{about}, "Got common facet data"); + +is_deeply( + $facet_data->{errors}, + [{ + tag => 'ERROR', + fail => 1, + details => $str, + }], + "Got error facet", +); + done_testing; diff --git a/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t b/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t index 69641520fe..6f31c888ae 100644 --- a/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t +++ b/cpan/Test-Simple/t/Test2/modules/Formatter/TAP.t @@ -20,7 +20,16 @@ BEGIN { use Test2::Tools::Tiny; use Test2::API qw/context/; -use PerlIO; + +BEGIN { + eval { + require PerlIO; + PerlIO->VERSION(1.02); # required for PerlIO::get_layers + } or do { + print "1..0 # SKIP Don't have PerlIO 1.02\n"; + exit 0; + } +} sub grabber { my ($std, $err); diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t index cbdca09b77..0f013286bc 100644 --- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t +++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t @@ -25,6 +25,8 @@ for my $meth (qw/send cull add_hub drop_hub waiting is_viable/) { ); } +SKIP: { + last SKIP if $] lt "5.008"; tests abort => sub { my $one = Test2::IPC::Driver->new(no_fatal => 1); my ($err, $out) = ("", ""); @@ -53,5 +55,6 @@ tests abort => sub { is($out, "not ok - IPC Fatal Error\n", "got 'not ok' on stdout"); like($err, qr/IPC Fatal Error: foo/, "Got error"); }; +} done_testing; diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t index a29023aa78..9ca1f5c84e 100644 --- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t +++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t @@ -6,6 +6,11 @@ use List::Util qw/shuffle/; use strict; use warnings; +if ($] lt "5.008") { + print "1..0 # SKIP Test cannot run on perls below 5.8.0\n"; + exit 0; +} + sub simple_capture(&) { my $code = shift; diff --git a/cpan/Test-Simple/t/Test2/modules/Util.t b/cpan/Test-Simple/t/Test2/modules/Util.t index f47f3f30e4..4299b7e6b3 100644 --- a/cpan/Test-Simple/t/Test2/modules/Util.t +++ b/cpan/Test-Simple/t/Test2/modules/Util.t @@ -18,6 +18,8 @@ use Test2::Util qw/ CAN_SIGSYS IS_WIN32 + + clone_io /; { @@ -58,4 +60,18 @@ ok($check_for_sig_sys->("FOO BAR SYS"), "Found SIGSYS at end"); ok(!$check_for_sig_sys->("FOO SYSX BAR"), "SYSX is not SYS"); ok(!$check_for_sig_sys->("FOO XSYS BAR"), "XSYS is not SYS"); +my $io = clone_io(\*STDOUT); +ok($io, "Cloned the filehandle"); +close($io); + +my $out = ''; +open(my $fh, '>', \$out) or die "Could not open filehandle"; + +$io = clone_io($fh); +is($io, $fh, "For a scalar handle we simply return the original handle, no other choice"); +print $io "Test\n"; + +is($out, "Test\n", "wrote to the scalar handle"); + + done_testing; diff --git a/cpan/Test-Simple/t/Test2/regression/gh_16.t b/cpan/Test-Simple/t/Test2/regression/gh_16.t index 45e4cd7b76..a2d46f2d04 100644 --- a/cpan/Test-Simple/t/Test2/regression/gh_16.t +++ b/cpan/Test-Simple/t/Test2/regression/gh_16.t @@ -10,7 +10,7 @@ END { $? = 0 } BEGIN { print "\n1..1\n"; close(STDERR); - open(STDERR, '>&', STDOUT); + open(STDERR, '>&STDOUT'); } use Test2::API; diff --git a/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t b/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t index a2964fd402..772d12acbc 100644 --- a/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t +++ b/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t @@ -7,6 +7,7 @@ use Test2::Util qw/CAN_FORK/; BEGIN { skip_all "System cannot fork" unless CAN_FORK; + skip_all "known to fail on $]" if $] le "5.006002"; } plan(3); diff --git a/cpan/Test-Simple/t/regression/errors_facet.t b/cpan/Test-Simple/t/regression/errors_facet.t new file mode 100644 index 0000000000..c4e30f995c --- /dev/null +++ b/cpan/Test-Simple/t/regression/errors_facet.t @@ -0,0 +1,53 @@ +use Test2::Tools::Tiny; +use Test2::API qw/intercept context/; + +{ + $INC{'My/Event.pm'} = 1; + + package My::Event; + use base 'Test2::Event'; + + use Test2::Util::Facets2Legacy ':ALL'; + + sub facet_data { + my $self = shift; + + my $out = $self->common_facet_data; + + $out->{errors} = [{tag => 'OOPS', fail => !$ENV{FAILURE_DO_PASS}, details => "An error occured"}]; + + return $out; + } +} + +sub error { + my $ctx = context(); + my $e = $ctx->send_event('+My::Event'); + $ctx->release; + return $e; +} + +my $events = intercept { + tests foo => sub { + ok(1, "need at least 1 assertion"); + error(); + }; +}; + +ok(!$events->[0]->pass, "Subtest did not pass"); + +my ($passing_a, $passing_b); +intercept { + my $hub = Test2::API::test2_stack->top; + + $passing_a = $hub->is_passing; + + error(); + + $passing_b = $hub->is_passing; +}; + +ok($passing_a, "Passign before error"); +ok(!$passing_b, "Not passing after error"); + +done_testing; |