From de4d091a920984dbbe514ab990b8c6f640b25a8d Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Wed, 16 Dec 2015 00:21:31 +0100 Subject: [PATCH] Test::Simple modernize again to 1.402075c Bumped version to protect it from overriding with the behind CPAN version 1.3, based on Test2. See GH #205 --- Porting/Maintainers.pl | 4 +- dist/Test-Simple/lib/Test/Builder.pm | 355 ++++++------------ dist/Test-Simple/lib/Test/Builder/Module.pm | 31 +- dist/Test-Simple/lib/Test/Builder/Tester.pm | 32 +- dist/Test-Simple/lib/Test/More.pm | 183 ++++----- dist/Test-Simple/lib/Test/Simple.pm | 3 +- dist/Test-Simple/t/Legacy/BEGIN_require_ok.t | 3 +- dist/Test-Simple/t/Legacy/BEGIN_use_ok.t | 3 +- dist/Test-Simple/t/Legacy/Builder/details.t | 2 +- dist/Test-Simple/t/Legacy/More.t | 7 +- dist/Test-Simple/t/Legacy/bad_plan.t | 3 +- dist/Test-Simple/t/Legacy/bail_out.t | 3 +- dist/Test-Simple/t/Legacy/buffer.t | 3 +- dist/Test-Simple/t/Legacy/capture.t | 4 +- dist/Test-Simple/t/Legacy/circular_data.t | 3 +- dist/Test-Simple/t/Legacy/diag.t | 3 +- dist/Test-Simple/t/Legacy/died.t | 3 +- .../t/Legacy/dont_overwrite_die_handler.t | 3 +- dist/Test-Simple/t/Legacy/eq_set.t | 3 +- dist/Test-Simple/t/Legacy/exit.t | 3 +- dist/Test-Simple/t/Legacy/explain.t | 3 +- dist/Test-Simple/t/Legacy/extra.t | 3 +- dist/Test-Simple/t/Legacy/extra_one.t | 3 +- dist/Test-Simple/t/Legacy/fail-like.t | 7 +- dist/Test-Simple/t/Legacy/fail-more.t | 15 +- dist/Test-Simple/t/Legacy/fail.t | 3 +- dist/Test-Simple/t/Legacy/fail_one.t | 3 +- dist/Test-Simple/t/Legacy/filehandles.t | 7 +- dist/Test-Simple/t/Legacy/harness_active.t | 3 +- dist/Test-Simple/t/Legacy/import.t | 3 +- dist/Test-Simple/t/Legacy/is_deeply_dne_bug.t | 3 +- dist/Test-Simple/t/Legacy/is_deeply_fail.t | 3 +- .../t/Legacy/is_deeply_with_threads.t | 3 +- dist/Test-Simple/t/Legacy/missing.t | 3 +- dist/Test-Simple/t/Legacy/new_ok.t | 7 +- dist/Test-Simple/t/Legacy/no_plan.t | 3 +- dist/Test-Simple/t/Legacy/no_tests.t | 3 +- dist/Test-Simple/t/Legacy/note.t | 3 +- dist/Test-Simple/t/Legacy/overload.t | 3 +- dist/Test-Simple/t/Legacy/overload_threads.t | 3 +- dist/Test-Simple/t/Legacy/plan.t | 3 +- dist/Test-Simple/t/Legacy/plan_bad.t | 5 +- dist/Test-Simple/t/Legacy/plan_is_noplan.t | 3 +- dist/Test-Simple/t/Legacy/plan_no_plan.t | 3 +- .../t/Legacy/plan_shouldnt_import.t | 3 +- dist/Test-Simple/t/Legacy/plan_skip_all.t | 3 +- dist/Test-Simple/t/Legacy/require_ok.t | 3 +- dist/Test-Simple/t/Legacy/simple.t | 3 +- dist/Test-Simple/t/Legacy/skip.t | 30 +- dist/Test-Simple/t/Legacy/skipall.t | 3 +- dist/Test-Simple/t/Legacy/subtest/args.t | 5 +- dist/Test-Simple/t/Legacy/subtest/fork.t | 20 +- dist/Test-Simple/t/Legacy/subtest/plan.t | 3 +- .../t/Legacy/tbm_doesnt_set_exported_to.t | 3 +- dist/Test-Simple/t/Legacy/todo.t | 3 +- dist/Test-Simple/t/Legacy/undef.t | 3 +- dist/Test-Simple/t/Legacy/useing.t | 3 +- dist/Test-Simple/t/Legacy/utf8.t | 3 +- 58 files changed, 319 insertions(+), 521 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index be59bcebd94..0e35a4d05e0 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1404,7 +1404,7 @@ package Maintainers; 'Test::Simple' => { # cperl modernizations TODO # Test2 based 1.3x versions are not yet modernized, - 'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302059.tar.gz', + 'DISTRIBUTION' => 'EXODIST/Test-Simple-1.302075.tar.gz', 'FILES' => q[dist/Test-Simple], 'EXCLUDED' => [ qr{^t/xt}, @@ -1413,8 +1413,6 @@ package Maintainers; qw( .perlcriticrc .perltidyrc appveyor.yml - examples/indent.pl - examples/subtest.t t/00compile.t t/xxx-changes_updated.t t/zzz-check-breaks.t diff --git a/dist/Test-Simple/lib/Test/Builder.pm b/dist/Test-Simple/lib/Test/Builder.pm index 16126a61180..d210147cd49 100644 --- a/dist/Test-Simple/lib/Test/Builder.pm +++ b/dist/Test-Simple/lib/Test/Builder.pm @@ -4,7 +4,7 @@ use 5.006; use strict; use warnings; -our $VERSION = '1.302075'; +our $VERSION = '1.402075'; BEGIN { if( $] < 5.008 ) { @@ -40,8 +40,7 @@ use Test::Builder::TodoDiag; our $Level = 1; our $Test = $ENV{TB_NO_EARLY_INIT} ? undef : Test::Builder->new; -sub _add_ts_hooks { - my $self = shift; +sub _add_ts_hooks ($self) { my $hub = $self->{Stack}->top; # Take a reference to the hash key, we do this to avoid closing over $self @@ -51,9 +50,7 @@ sub _add_ts_hooks { #$hub->add_context_aquire(sub {$_[0]->{level} += $Level - 1}); - $hub->pre_filter(sub { - my ($active_hub, $e) = @_; - + $hub->pre_filter(sub ($active_hub, $e) { my $epkg = $$epkgr; my $cpkg = $e->{trace} ? $e->{trace}->{frame}->[0] : undef; @@ -84,8 +81,7 @@ sub _add_ts_hooks { }, inherit => 1); } -sub new { - my($class) = shift; +sub new ($class, @args) { unless($Test) { my $ctx = context(); $Test = $class->create(singleton => 1); @@ -96,17 +92,14 @@ sub new { # TB->ctx compensates for this later. Test2::API::test2_add_callback_context_aquire(sub { $_[0]->{level} += $Level - 1 }); - Test2::API::test2_add_callback_exit(sub { $Test->_ending(@_) }); + Test2::API::test2_add_callback_exit(sub { $Test->_ending(@args) }); Test2::API::test2_ipc()->set_no_fatal(1) if USE_THREADS; } return $Test; } -sub create { - my $class = shift; - my %params = @_; - +sub create ($class, %params) { my $self = bless {}, $class; if ($params{singleton}) { $self->{Stack} = Test2::API::test2_stack(); @@ -137,8 +130,7 @@ sub ctx { ); } -sub parent { - my $self = shift; +sub parent ($self) { my $ctx = $self->ctx; my $chub = $self->{Hub} || $ctx->hub; $ctx->release; @@ -154,8 +146,7 @@ sub parent { }, blessed($self); } -sub child { - my( $self, $name ) = @_; +sub child ( $self, $name? ) { $name ||= "Child of " . $self->name; my $ctx = $self->ctx; @@ -176,9 +167,7 @@ sub child { class => 'Test2::Hub::Subtest', ); - $hub->pre_filter(sub { - my ($active_hub, $e) = @_; - + $hub->pre_filter(sub ($active_hub, $e) { # Turn a diag into a todo diag return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag'; @@ -187,7 +176,8 @@ sub child { $hub->listen(sub { push @$subevents => $_[1] }); - $hub->set_nested( $parent->isa('Test2::Hub::Subtest') ? $parent->nested + 1 : 1 ); + $hub->set_nested( $parent->isa('Test2::Hub::Subtest') + ? $parent->nested + 1 : 1 ); my $meta = $hub->meta(__PACKAGE__, {}); $meta->{Name} = $name; @@ -202,13 +192,11 @@ sub child { $self->_add_ts_hooks; $ctx->release; - return bless { Original_Pid => $$, Stack => $self->{Stack}, Hub => $hub }, blessed($self); + return bless { Original_Pid => $$, Stack => $self->{Stack}, Hub => $hub }, + blessed($self); } -sub finalize { - my $self = shift; - my $ok = 1; - ($ok) = @_ if @_; +sub finalize ($self, $ok=1) { my $st_ctx = $self->ctx; my $chub = $self->{Hub} || return $st_ctx->release; @@ -286,9 +274,10 @@ FAIL return $chub->is_passing; } -sub subtest { - my $self = shift; - my ($name, $code, @args) = @_; +#sub subtest { +# my $self = shift; +# my ($name, $code, @args) = @_; +sub subtest ($self, str $name, $code, @args) :prototype($*&@) { my $ctx = $self->ctx; $ctx->throw("subtest()'s second argument must be a code ref") unless $code && reftype($code) eq 'CODE'; @@ -310,7 +299,8 @@ sub subtest { ($err, $child_error) = ($@, $?); # They might have done 'BEGIN { skip_all => "whatever" }' - if (!$ok && $err =~ m/Label not found for "last T2_SUBTEST_WRAPPER"/ || (blessed($err) && blessed($err) eq 'Test::Builder::Exception')) { + if (!$ok && $err =~ m/Label not found for "last T2_SUBTEST_WRAPPER"/ + || (blessed($err) && blessed($err) eq 'Test::Builder::Exception')) { $ok = undef; $err = undef; } @@ -337,7 +327,7 @@ sub subtest { $err = "Subtest ended with exit code $code" if $code; } - my $st_hub = $st_ctx->hub; + my $st_hub = $st_ctx->hub; my $plan = $st_hub->plan; my $count = $st_hub->count; @@ -357,14 +347,12 @@ sub subtest { return $st_hub->is_passing; } -sub name { - my $self = shift; +sub name ($self) { my $ctx = $self->ctx; release $ctx, $ctx->hub->meta(__PACKAGE__, {})->{Name}; } -sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms) - my ($self, %params) = @_; +sub reset ($self, %params) { ## no critic (Subroutines::ProhibitBuiltinHomonyms) Test2::API::test2_set_is_end(0); @@ -418,8 +406,7 @@ my %plan_cmds = ( tests => \&_plan_tests, ); -sub plan { - my( $self, $cmd, $arg ) = @_; +sub plan ( $self, $cmd?, $arg? ) { return unless $cmd; @@ -443,12 +430,11 @@ sub plan { } -sub _plan_tests { - my($self, $arg) = @_; +sub _plan_tests ($self, $arg?) { my $ctx = $self->ctx; - if($arg) { + if (defined $arg and $arg) { local $Level = $Level + 1; $self->expected_tests($arg); } @@ -463,15 +449,13 @@ sub _plan_tests { } -sub expected_tests { - my $self = shift; - my($max) = @_; +sub expected_tests ($self, int $max=0) { my $ctx = $self->ctx; - if(@_) { + if ($max) { $self->croak("Number of tests must be a positive integer. You gave it '$max'") - unless $max =~ /^\+?\d+$/; + unless $max =~ /^\+?\d+$/; $ctx->plan($max); } @@ -487,8 +471,7 @@ sub expected_tests { } -sub no_plan { - my($self, $arg) = @_; +sub no_plan ($self, $arg?) { my $ctx = $self->ctx; @@ -506,8 +489,7 @@ sub no_plan { } -sub done_testing { - my($self, $num_tests) = @_; +sub done_testing ($self, int $num_tests=0) { my $ctx = $self->ctx; @@ -549,8 +531,7 @@ sub done_testing { } -sub has_plan { - my $self = shift; +sub has_plan ($self) { my $ctx = $self->ctx; my $plan = $ctx->hub->plan; @@ -562,8 +543,7 @@ sub has_plan { } -sub skip_all { - my( $self, $reason ) = @_; +sub skip_all ( $self, str $reason='' ) { my $ctx = $self->ctx; @@ -587,8 +567,7 @@ sub skip_all { } -sub exported_to { - my( $self, $pack ) = @_; +sub exported_to ($self, $pack?) { if( defined $pack ) { $self->{Exported_To} = $pack; @@ -597,8 +576,7 @@ sub exported_to { } -sub ok { - my( $self, $test, $name ) = @_; +sub ok ($self, $test, $name?) { my $ctx = $self->ctx; @@ -626,7 +604,7 @@ sub ok { actual_ok => $test, reason => '', type => '', - (name => defined($name) ? $name : ''), + name => $name, }; $hub->{_meta}->{+__PACKAGE__}->{Test_Results}[ $hub->{count} ] = $result; @@ -659,9 +637,7 @@ sub ok { return $test; } -sub _ok_debug { - my $self = shift; - my ($trace, $orig_name) = @_; +sub _ok_debug ($self, $trace, str $orig_name) { my $is_todo = defined($self->todo); @@ -680,14 +656,12 @@ sub _ok_debug { } } -sub _diag_fh { - my $self = shift; +sub _diag_fh ($self) { local $Level = $Level + 1; return $self->in_todo ? $self->todo_output : $self->failure_output; } -sub _unoverload { - my ($self, $type, $thing) = @_; +sub _unoverload ($self, $type, $thing) { return unless ref $$thing; return unless blessed($$thing) || scalar $self->_try(sub{ $$thing->isa('UNIVERSAL') }); @@ -699,27 +673,21 @@ sub _unoverload { $$thing = $$thing->$string_meth(); } -sub _unoverload_str { - my $self = shift; - - $self->_unoverload( q[""], $_ ) for @_; +sub _unoverload_str ($self, @args) { + $self->_unoverload( q[""], $_ ) for @args; } -sub _unoverload_num { - my $self = shift; - - $self->_unoverload( '0+', $_ ) for @_; +sub _unoverload_num ($self, @args) { + $self->_unoverload( '0+', $_ ) for @args; - for my $val (@_) { + for my $val (@args) { next unless $self->_is_dualvar($$val); $$val = $$val + 0; } } # This is a hack to detect a dualvar such as $! -sub _is_dualvar { - my( $self, $val ) = @_; - +sub _is_dualvar ($self, $val) { # Objects are not dualvars. return 0 if ref $val; @@ -729,11 +697,8 @@ sub _is_dualvar { } -sub is_eq { - my( $self, $got, $expect, $name ) = @_; - +sub is_eq ( $self, $got?, $expect?, $name?) { my $ctx = $self->ctx; - local $Level = $Level + 1; if( !defined $got || !defined $expect ) { @@ -750,8 +715,7 @@ sub is_eq { } -sub is_num { - my( $self, $got, $expect, $name ) = @_; +sub is_num ($self, $got, $expect, $name?) { my $ctx = $self->ctx; local $Level = $Level + 1; @@ -768,9 +732,7 @@ sub is_num { release $ctx, $self->cmp_ok( $got, '==', $expect, $name ); } - -sub _diag_fmt { - my( $self, $type, $val ) = @_; +sub _diag_fmt ($self, $type, $val) { if( defined $$val ) { if( $type eq 'eq' or $type eq 'ne' ) { @@ -789,9 +751,7 @@ sub _diag_fmt { return; } - -sub _is_diag { - my( $self, $got, $type, $expect ) = @_; +sub _is_diag ( $self, $got, $type, $expect ) { $self->_diag_fmt( $type, $_ ) for \$got, \$expect; @@ -803,8 +763,7 @@ DIAGNOSTIC } -sub _isnt_diag { - my( $self, $got, $type ) = @_; +sub _isnt_diag ( $self, $got, $type ) { $self->_diag_fmt( $type, \$got ); @@ -816,8 +775,7 @@ DIAGNOSTIC } -sub isnt_eq { - my( $self, $got, $dont_expect, $name ) = @_; +sub isnt_eq ( $self, $got?, $dont_expect?, $name?) { my $ctx = $self->ctx; local $Level = $Level + 1; @@ -834,8 +792,7 @@ sub isnt_eq { release $ctx, $self->cmp_ok( $got, 'ne', $dont_expect, $name ); } -sub isnt_num { - my( $self, $got, $dont_expect, $name ) = @_; +sub isnt_num ( $self, $got, $dont_expect, $name?) { my $ctx = $self->ctx; local $Level = $Level + 1; @@ -853,19 +810,15 @@ sub isnt_num { } -sub like { - my( $self, $thing, $regex, $name ) = @_; +sub like ( $self, $thing, $regex, $name?) { my $ctx = $self->ctx; - local $Level = $Level + 1; release $ctx, $self->_regex_ok( $thing, $regex, '=~', $name ); } -sub unlike { - my( $self, $thing, $regex, $name ) = @_; +sub unlike ( $self, $thing, $regex, $name?) { my $ctx = $self->ctx; - local $Level = $Level + 1; release $ctx, $self->_regex_ok( $thing, $regex, '!~', $name ); @@ -877,8 +830,7 @@ my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" ) # Bad, these are not comparison operators. Should we include more? my %cmp_ok_bl = map { ( $_, 1 ) } ( "=", "+=", ".=", "x=", "^=", "|=", "||=", "&&=", "..."); -sub cmp_ok { - my( $self, $got, $type, $expect, $name ) = @_; +sub cmp_ok ($self, $got, $type, $expect, $name?) { my $ctx = $self->ctx; if ($cmp_ok_bl{$type}) { @@ -948,8 +900,7 @@ END return release $ctx, $ok; } -sub _cmp_diag { - my( $self, $got, $type, $expect ) = @_; +sub _cmp_diag ($self, $got, $type, $expect) { $got = defined $got ? "'$got'" : 'undef'; $expect = defined $expect ? "'$expect'" : 'undef'; @@ -962,20 +913,15 @@ sub _cmp_diag { DIAGNOSTIC } -sub _caller_context { - my $self = shift; - +sub _caller_context ($self) { my( $pack, $file, $line ) = $self->caller(1); - my $code = ''; $code .= "#line $line $file\n" if defined $file and defined $line; - return $code; } -sub BAIL_OUT { - my( $self, $reason ) = @_; +sub BAIL_OUT ( $self, str $reason ) { my $ctx = $self->ctx; @@ -990,10 +936,7 @@ sub BAIL_OUT { *BAILOUT = \&BAIL_OUT; } -sub skip { - my( $self, $why, $name ) = @_; - $why ||= ''; - $name = '' unless defined $name; +sub skip ( $self, str $why='', str $name='' ) { $self->_unoverload_str( \$why ); my $ctx = $self->ctx; @@ -1017,9 +960,7 @@ sub skip { } -sub todo_skip { - my( $self, $why ) = @_; - $why ||= ''; +sub todo_skip ( $self, str $why='') { my $ctx = $self->ctx; @@ -1039,8 +980,7 @@ sub todo_skip { } -sub maybe_regex { - my( $self, $regex ) = @_; +sub maybe_regex ( $self, $regex ) { my $usable_regex = undef; return $usable_regex unless defined $regex; @@ -1062,17 +1002,14 @@ sub maybe_regex { return $usable_regex; } -sub _is_qr { - my $regex = shift; - +sub _is_qr ($regex) { # is_regexp() checks for regexes in a robust manner, say if they're # blessed. return re::is_regexp($regex) if defined &re::is_regexp; return ref $regex eq 'Regexp'; } -sub _regex_ok { - my( $self, $thing, $regex, $cmp, $name ) = @_; +sub _regex_ok ( $self, $thing, $regex, $cmp, $name) { my $ok = 0; my $usable_regex = $self->maybe_regex($regex); @@ -1120,9 +1057,7 @@ DIAGNOSTIC } -sub is_fh { - my $self = shift; - my $maybe_fh = shift; +sub is_fh ($self, $maybe_fh?) { return 0 unless defined $maybe_fh; return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref @@ -1132,19 +1067,15 @@ sub is_fh { eval { tied($maybe_fh)->can('TIEHANDLE') }; } - -sub level { - my( $self, $level ) = @_; - - if( defined $level ) { +sub level ($self, $level?) { + if ( defined $level ) { $Level = $level; } return $Level; } -sub use_numbers { - my( $self, $use_nums ) = @_; +sub use_numbers ( $self, $use_nums? ) { my $ctx = $self->ctx; my $format = $ctx->hub->format; @@ -1159,11 +1090,9 @@ sub use_numbers { } BEGIN { - for my $method (qw(no_header no_diag)) { - my $set = "set_$method"; - my $code = sub { - my( $self, $no ) = @_; - + for my str $method (qw(no_header no_diag)) { + my str $set = "set_$method"; + my $code = sub ($self, $no?) { my $ctx = $self->ctx; my $format = $ctx->hub->format; unless ($format && $format->can($set)) { @@ -1182,9 +1111,7 @@ BEGIN { } } -sub no_ending { - my( $self, $no ) = @_; - +sub no_ending ($self, $no?) { my $ctx = $self->ctx; $ctx->hub->set_no_ending($no) if defined $no; @@ -1192,31 +1119,27 @@ sub no_ending { return release $ctx, $ctx->hub->no_ending; } -sub diag { - my $self = shift; - return unless @_; +sub diag ($self, @args) { + return unless @args; my $ctx = $self->ctx; - $ctx->diag(join '' => map {defined($_) ? $_ : 'undef'} @_); + $ctx->diag(join '' => map {defined($_) ? $_ : 'undef'} @args); $ctx->release; return 0; } -sub note { - my $self = shift; - return unless @_; +sub note ($self, @args) { + return unless @args; my $ctx = $self->ctx; - $ctx->note(join '' => map {defined($_) ? $_ : 'undef'} @_); + $ctx->note(join '' => map {defined($_) ? $_ : 'undef'} @args); $ctx->release; return 0; } -sub explain { - my $self = shift; - +sub explain ($self, @args) { local ($@, $!); require Data::Dumper; @@ -1229,13 +1152,11 @@ sub explain { $dumper->Dump; } : $_ - } @_; + } @args; } -sub output { - my( $self, $fh ) = @_; - +sub output ($self, $fh?) { my $ctx = $self->ctx; my $format = $ctx->hub->format; $ctx->release; @@ -1247,9 +1168,7 @@ sub output { return $format->handles->[Test2::Formatter::TAP::OUT_STD()]; } -sub failure_output { - my( $self, $fh ) = @_; - +sub failure_output ($self, $fh?) { my $ctx = $self->ctx; my $format = $ctx->hub->format; $ctx->release; @@ -1261,9 +1180,7 @@ sub failure_output { return $format->handles->[Test2::Formatter::TAP::OUT_ERR()]; } -sub todo_output { - my( $self, $fh ) = @_; - +sub todo_output ($self, $fh?) { my $ctx = $self->ctx; my $format = $ctx->hub->format; $ctx->release; @@ -1275,10 +1192,7 @@ sub todo_output { return $format->handles->[Test::Builder::Formatter::OUT_TODO()]; } -sub _new_fh { - my $self = shift; - my($file_or_fh) = shift; - +sub _new_fh ($self, $file_or_fh) { my $fh; if( $self->is_fh($file_or_fh) ) { $fh = $file_or_fh; @@ -1304,8 +1218,7 @@ sub _new_fh { return $fh; } -sub _autoflush { - my($fh) = shift; +sub _autoflush ($fh) { my $old_fh = select $fh; $| = 1; select $old_fh; @@ -1314,9 +1227,7 @@ sub _autoflush { } -sub reset_outputs { - my $self = shift; - +sub reset_outputs ($self) { my $ctx = $self->ctx; my $format = $ctx->hub->format; $ctx->release; @@ -1326,24 +1237,20 @@ sub reset_outputs { return; } - -sub carp { - my $self = shift; +sub carp ($self, @args) { my $ctx = $self->ctx; - $ctx->alert(join "", @_); + $ctx->alert(join "", @args); $ctx->release; } -sub croak { - my $self = shift; +sub croak ($self, @args) { my $ctx = $self->ctx; - $ctx->throw(join "", @_); + $ctx->throw(join "", @args); $ctx->release; } -sub current_test { - my( $self, $num ) = @_; +sub current_test ( $self, $num? ) { my $ctx = $self->ctx; my $hub = $ctx->hub; @@ -1374,14 +1281,11 @@ sub current_test { } -sub is_passing { - my $self = shift; - +sub is_passing ($self, $bool?) { my $ctx = $self->ctx; my $hub = $ctx->hub; - if( @_ ) { - my ($bool) = @_; + if (defined $bool) { $hub->set_failed(0) if $bool; $hub->is_passing($bool); } @@ -1390,9 +1294,7 @@ sub is_passing { } -sub summary { - my($self) = shift; - +sub summary ($self) { my $ctx = $self->ctx; my $data = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results}; $ctx->release; @@ -1400,8 +1302,7 @@ sub summary { } -sub details { - my $self = shift; +sub details ($self) { my $ctx = $self->ctx; my $data = $ctx->hub->meta(__PACKAGE__, {})->{Test_Results}; $ctx->release; @@ -1409,8 +1310,7 @@ sub details { } -sub find_TODO { - my( $self, $pack, $set, $new_value ) = @_; +sub find_TODO ($self, $pack, $set, $new_value) { my $ctx = $self->ctx; @@ -1426,9 +1326,7 @@ sub find_TODO { return $old_value; } -sub todo { - my( $self, $pack ) = @_; - +sub todo ($self, $pack?) { local $Level = $Level + 1; my $ctx = $self->ctx; $ctx->release; @@ -1445,9 +1343,7 @@ sub todo { return ${ $pack . '::TODO' }; } -sub in_todo { - my $self = shift; - +sub in_todo ($self) { local $Level = $Level + 1; my $ctx = $self->ctx; $ctx->release; @@ -1466,16 +1362,11 @@ sub in_todo { return 1; } -sub todo_start { - my $self = shift; - my $message = @_ ? shift : ''; - +sub todo_start ($self, str $message='') { my $ctx = $self->ctx; my $hub = $ctx->hub; - my $filter = $hub->pre_filter(sub { - my ($active_hub, $e) = @_; - + my $filter = $hub->pre_filter(sub ($active_hub, $e) { # Turn a diag into a todo diag return Test::Builder::TodoDiag->new(%$e) if ref($e) eq 'Test2::Event::Diag'; @@ -1501,9 +1392,7 @@ sub todo_start { return; } -sub todo_end { - my $self = shift; - +sub todo_end ($self) { my $ctx = $self->ctx; my $set = pop @{$ctx->hub->meta(__PACKAGE__, {todo => []})->{todo}}; @@ -1517,10 +1406,9 @@ sub todo_end { return; } - -sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms) - my( $self ) = @_; - +# XXX height is ignored +## no critic (Subroutines::ProhibitBuiltinHomonyms) +sub caller ($self, int $height = 0) { my $ctx = $self->ctx; my $trace = $ctx->trace; @@ -1528,9 +1416,8 @@ sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms) return wantarray ? $trace->call : $trace->package; } - -sub _try { - my( $self, $code, %opts ) = @_; +# %opts is ignored +sub _try ($self, $code, %opts) { my $error; my $return; @@ -1550,7 +1437,6 @@ sub _try { sub _ending { my $self = shift; my ($ctx, $real_exit_code, $new) = @_; - unless ($ctx) { my $octx = $self->ctx; $ctx = $octx->snapshot; @@ -1666,9 +1552,7 @@ FAIL # Some things used this even though it was private... I am looking at you # Test::Builder::Prefix... -sub _print_comment { - my( $self, $fh, @msgs ) = @_; - +sub _print_comment ($self, $fh, @msgs) { return if $self->no_diag; return unless @msgs; @@ -1693,9 +1577,7 @@ sub _print_comment { # Test::Builder 2 # Once Test2 stuff goes stable this method will be removed and Test::SharedFork # will be made smarter. -sub coordinate_forks { - my $self = shift; - +sub coordinate_forks ($self) { { local ($@, $!); require Test2::IPC; @@ -1723,10 +1605,8 @@ Test::Builder - Backend for building test libraries my $CLASS = __PACKAGE__; - sub ok { - my($test, $name) = @_; + sub ok ($test, $name) { my $tb = $CLASS->builder; - $tb->ok($test, $name); } @@ -2047,8 +1927,7 @@ regular expression, or C if its argument is not recognized. For example, a version of C, sans the useful diagnostic messages, could be written as: - sub laconic_like { - my ($self, $thing, $regex, $name) = @_; + sub laconic_like ($self, $thing, $regex, $name) { my $usable_regex = $self->maybe_regex($regex); die "expecting regex, found '$regex'\n" unless $usable_regex; @@ -2075,24 +1954,24 @@ Determines if the given C<$thing> can be used as a filehandle. =item B - $Test->level($how_high); + $Test->level( [$Test::Builder::Level] ); +Gets or sets $Test::Builder::Level. How far up the call stack should C<$Test> look when reporting where the test failed. -Defaults to 1. +The default $Test::Builder::Level is 1. -Setting L<$Test::Builder::Level> overrides. This is typically useful +Setting L<$Test::Builder::Level> is typically useful localized: - sub my_ok { - my $test = shift; - + sub my_ok ($test) { local $Test::Builder::Level = $Test::Builder::Level + 1; $TB->ok($test); } -To be polite to other functions wrapping your own you usually want to increment C<$Level> rather than set it to a constant. +To be polite to other functions wrapping your own you usually want to +increment C<$Level> rather than set it to a constant. =item B @@ -2501,6 +2380,8 @@ L, L, L Original code by chromatic, maintained by Michael G Schwern Eschwern@pobox.comE +Modernized by Reini Urban for cperl signatures. + =head1 MAINTAINERS =over 4 diff --git a/dist/Test-Simple/lib/Test/Builder/Module.pm b/dist/Test-Simple/lib/Test/Builder/Module.pm index 012759b50fb..d7ad01bb185 100644 --- a/dist/Test-Simple/lib/Test/Builder/Module.pm +++ b/dist/Test-Simple/lib/Test/Builder/Module.pm @@ -7,8 +7,8 @@ use Test::Builder; require Exporter; our @ISA = qw(Exporter); -our $VERSION = '1.302075'; - +our $VERSION = '1.402075c'; +$VERSION =~ s/c$//; =head1 NAME @@ -24,9 +24,9 @@ Test::Builder::Module - Base class for test modules use parent 'Test::Builder::Module'; @EXPORT = qw(ok); - sub ok ($;$) { + sub ok ($test, $name?) { my $tb = $CLASS->builder; - return $tb->ok(@_); + return $tb->ok($test, $name); } 1; @@ -72,9 +72,10 @@ C. =cut +#sub import ($class, @args) { sub import { - my($class) = shift; - + my $class = shift; + my @args = @_; # Don't run all this when loading ourself. return 1 if $class eq 'Test::Builder::Module'; @@ -84,18 +85,21 @@ sub import { $test->exported_to($caller); - $class->import_extra( \@_ ); - my(@imports) = $class->_strip_imports( \@_ ); + # if called with arrayref + #if (@args and scalar(@args) == 1 and ref($args[0]) eq 'ARRAY') { + # @args = ($args[0]); + # warn @args; + #} + $class->import_extra( \@args ); + my(@imports) = $class->_strip_imports( \@args ); - $test->plan(@_); + $test->plan(@args); local $Exporter::ExportLevel = $Exporter::ExportLevel + 1; $class->Exporter::import(@imports); } -sub _strip_imports { - my $class = shift; - my $list = shift; +sub _strip_imports ($class, $list) { my @imports = (); my @other = (); @@ -159,14 +163,13 @@ call C inside each function rather than store it in a global. sub ok { my $builder = Your::Class->builder; - return $builder->ok(@_); } =cut -sub builder { +sub builder () { return Test::Builder->new; } diff --git a/dist/Test-Simple/lib/Test/Builder/Tester.pm b/dist/Test-Simple/lib/Test/Builder/Tester.pm index c30ff1d0710..2070d74c4f5 100644 --- a/dist/Test-Simple/lib/Test/Builder/Tester.pm +++ b/dist/Test-Simple/lib/Test/Builder/Tester.pm @@ -1,7 +1,8 @@ package Test::Builder::Tester; use strict; -our $VERSION = '1.302075'; +our $VERSION = '1.402075c'; +$VERSION = s/c$//; use Test::Builder; use Symbol; @@ -509,16 +510,14 @@ sub expect { } } -sub _account_for_subtest { - my( $self, $check ) = @_; +sub _account_for_subtest ( $self, $check ) { my $hub = $t->{Stack}->top; my $nesting = $hub->isa('Test2::Hub::Subtest') ? $hub->nested : 0; return ref($check) ? $check : (' ' x $nesting) . $check; } -sub _translate_Failed_check { - my( $self, $check ) = @_; +sub _translate_Failed_check ( $self, $check ) { if( $check =~ /\A(.*)# (Failed .*test) \((.*?) at line (\d+)\)\Z(?!\n)/ ) { $check = "/\Q$1\E#\\s+\Q$2\E.*?\\n?.*?\Qat $3\E line \Q$4\E.*\\n?/"; @@ -530,8 +529,7 @@ sub _translate_Failed_check { ## # return true iff the expected data matches the got data -sub check { - my $self = shift; +sub check ($self) { # turn off warnings as these might be undef local $^W = 0; @@ -550,8 +548,7 @@ sub check { # a complaint message about the inputs not matching (to be # used for debugging messages) -sub complaint { - my $self = shift; +sub complaint ($self) { my $type = $self->type; my $got = $self->got; my $wanted = join '', @{ $self->wanted }; @@ -624,8 +621,7 @@ sub complaint { ## # forget all expected and got data -sub reset { - my $self = shift; +sub reset ($self) { %$self = ( type => $self->{type}, got => '', @@ -633,18 +629,15 @@ sub reset { ); } -sub got { - my $self = shift; +sub got ($self) { return $self->{got}; } -sub wanted { - my $self = shift; +sub wanted ($self) { return $self->{wanted}; } -sub type { - my $self = shift; +sub type ($self) { return $self->{type}; } @@ -657,13 +650,10 @@ sub PRINT { $self->{got} .= join '', @_; } -sub TIEHANDLE { - my( $class, $type ) = @_; +sub TIEHANDLE ( $class, $type ) { my $self = bless { type => $type }, $class; - $self->reset; - return $self; } diff --git a/dist/Test-Simple/lib/Test/More.pm b/dist/Test-Simple/lib/Test/More.pm index 0bfc06f6ab0..c64f1de1dfa 100644 --- a/dist/Test-Simple/lib/Test/More.pm +++ b/dist/Test-Simple/lib/Test/More.pm @@ -17,7 +17,8 @@ sub _carp { return warn @_, " at $file line $line\n"; } -our $VERSION = '1.302075'; +our $VERSION = '1.402075'; +$VERSION =~ s/c$//; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); @@ -163,18 +164,14 @@ or for deciding between running the tests at all: =cut -sub plan { - my $tb = Test::More->builder; - - return $tb->plan(@_); +# TODO (...) +sub plan (@args) { + Test::More->builder->plan(@args); } # This implements "use Test::More 'no_diag'" but the behavior is # deprecated. -sub import_extra { - my $class = shift; - my $list = shift; - +sub import_extra ($class, $list) { my @other = (); my $idx = 0; my $import; @@ -243,8 +240,7 @@ completed. If you use an END block you completely bypass this protection. =cut sub done_testing { - my $tb = Test::More->builder; - $tb->done_testing(@_); + Test::More->builder->done_testing(@_); } =head2 Test names @@ -314,11 +310,8 @@ This is the same as L's C routine. =cut -sub ok ($;$) { - my( $test, $name ) = @_; - my $tb = Test::More->builder; - - return $tb->ok( $test, $name ); +sub ok ($test, $name?) { + Test::More->builder->ok( $test, $name ); } =item B @@ -398,18 +391,14 @@ function which is an alias of C. =cut sub is ($$;$) { - my $tb = Test::More->builder; - - return $tb->is_eq(@_); + Test::More->builder->is_eq(@_); } sub isnt ($$;$) { - my $tb = Test::More->builder; - - return $tb->isnt_eq(@_); + Test::More->builder->isnt_eq(@_); } -*isn't = \&isnt; +# *isn't = \&isnt; # ' to unconfuse syntax higlighters =item B @@ -443,9 +432,7 @@ diagnostics on failure. =cut sub like ($$;$) { - my $tb = Test::More->builder; - - return $tb->like(@_); + Test::More->builder->like(@_); } =item B @@ -458,9 +445,7 @@ given pattern. =cut sub unlike ($$;$) { - my $tb = Test::More->builder; - - return $tb->unlike(@_); + Test::More->builder->unlike(@_); } =item B @@ -504,9 +489,7 @@ relation between values: =cut sub cmp_ok($$$;$) { - my $tb = Test::More->builder; - - return $tb->cmp_ok(@_); + Test::More->builder->cmp_ok(@_); } =item B @@ -538,8 +521,7 @@ as one test. If you desire otherwise, use: =cut -sub can_ok ($@) { - my( $proto, @methods ) = @_; +sub can_ok ($proto, @methods) { my $class = ref $proto || $proto; my $tb = Test::More->builder; @@ -604,8 +586,7 @@ you'd like them to be more specific, you can supply an $object_name =cut -sub isa_ok ($$;$) { - my( $thing, $class, $thing_name ) = @_; +sub isa_ok ($thing, $class, $thing_name?) { my $tb = Test::More->builder; my $whatami; @@ -705,22 +686,20 @@ just a single object which isa C<$class>. =cut -sub new_ok { +sub new_ok ($class, $args?, $object_name?) { my $tb = Test::More->builder; - $tb->croak("new_ok() must be given at least a class") unless @_; - - my( $class, $args, $object_name ) = @_; + # $tb->croak("new_ok() must be given at least a class") unless defined $class; $args ||= []; my $obj; - my( $success, $error ) = $tb->_try( sub { $obj = $class->new(@$args); 1 } ); - if($success) { + my ($success, $error) = $tb->_try( sub { $obj = $class->new(@$args); 1 } ); + if ($success) { local $Test::Builder::Level = $Test::Builder::Level + 1; - isa_ok $obj, $class, $object_name; + isa_ok($obj, $class, $object_name); } else { - $class = 'undef' if !defined $class; + $class = 'undef' if !length $class; $tb->ok( 0, "$class->new() died" ); $tb->diag(" Error was: $error"); } @@ -802,9 +781,8 @@ Extra arguments given to C are passed to the callback. For example: =cut -sub subtest { - my $tb = Test::More->builder; - return $tb->subtest(@_); +sub subtest ($name, $code, @args) { + Test::More->builder->subtest($name, $code, @args); } =item B @@ -825,15 +803,11 @@ Use these very, very, very sparingly. =cut sub pass (;$) { - my $tb = Test::More->builder; - - return $tb->ok( 1, @_ ); + Test::More->builder->ok( 1, @_ ); } sub fail (;$) { - my $tb = Test::More->builder; - - return $tb->ok( 0, @_ ); + Test::More->builder->ok( 0, @_ ); } =back @@ -877,8 +851,7 @@ No exception will be thrown if the load fails. =cut -sub require_ok ($) { - my($module) = shift; +sub require_ok ($module) { my $tb = Test::More->builder; my $pack = caller; @@ -908,8 +881,7 @@ DIAGNOSTIC return $ok; } -sub _is_module_name { - my $module = shift; +sub _is_module_name (str $module) { # Module names start with a letter. # End with an alphanumeric. @@ -971,9 +943,8 @@ import anything, use C. =cut -sub use_ok ($;@) { - my( $module, @imports ) = @_; - @imports = () unless @imports; +sub use_ok { #($module, @imports) { # XXX segv! + my ($module, @imports) = @_; my $tb = Test::More->builder; my %caller; @@ -1021,8 +992,7 @@ DIAGNOSTIC return $ok; } -sub _eval { - my( $code, @args ) = @_; +sub _eval ( $code, @args ) { # Work around oddities surrounding resetting of $@ by immediately # storing it. @@ -1092,8 +1062,8 @@ an C function that works like C with many improvements. our( @Data_Stack, %Refs_Seen ); my $DNE = bless [], 'Does::Not::Exist'; -sub _dne { - return ref $_[0] eq ref $DNE; +sub _dne ($obj) { + return ref $obj eq ref $DNE; } ## no critic (Subroutines::RequireArgUnpacking) @@ -1103,7 +1073,7 @@ sub is_deeply { unless( @_ == 2 or @_ == 3 ) { my $msg = <<'WARNING'; is_deeply() takes two or three args, you gave %d. -This usually means you passed an array or hash instead +This usually means you passed an array or hash instead of a reference to it WARNING chop $msg; # clip off newline so carp() will put in line/file @@ -1139,9 +1109,7 @@ WARNING return $ok; } -sub _format_stack { - my(@Stack) = @_; - +sub _format_stack (@Stack) { my $var = '$FOO'; my $did_arrow = 0; foreach my $entry (@Stack) { @@ -1182,8 +1150,7 @@ sub _format_stack { return $out; } -sub _type { - my $thing = shift; +sub _type ($thing) { return '' if !ref $thing; @@ -1250,11 +1217,11 @@ don't indicate a problem. =cut sub diag { - return Test::More->builder->diag(@_); + Test::More->builder->diag(@_); } sub note { - return Test::More->builder->note(@_); + Test::More->builder->note(@_); } =item B @@ -1276,7 +1243,7 @@ or =cut sub explain { - return Test::More->builder->explain(@_); + Test::More->builder->explain(@_); } =back @@ -1342,25 +1309,24 @@ use TODO. Read on. =cut ## no critic (Subroutines::RequireFinalReturn) -sub skip { - my( $why, $how_many ) = @_; +sub skip ( str $why = "", Numeric $how_many = 0) { my $tb = Test::More->builder; # If the plan is set, and is static, then skip needs a count. If the plan # is 'no_plan' we are fine. As well if plan is undefined then we are # waiting for done_testing. - unless (defined $how_many) { + unless ($how_many) { my $plan = $tb->has_plan; _carp "skip() needs to know \$how_many tests are in the block" if $plan && $plan =~ m/^\d+$/; $how_many = 1; } - if( defined $how_many and $how_many =~ /\D/ ) { - _carp - "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?"; - $how_many = 1; - } + #if ($how_many and $how_many =~ /\D/ ) { + # _carp + # "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?"; + # $how_many = 1; + #} for( 1 .. $how_many ) { $tb->skip($why); @@ -1428,11 +1394,10 @@ interpret them as passing. =cut -sub todo_skip { - my( $why, $how_many ) = @_; +sub todo_skip ( str $why = "", Numeric $how_many = 0) { my $tb = Test::More->builder; - unless( defined $how_many ) { + unless( $how_many ) { # $how_many can only be avoided when no_plan is in use. _carp "todo_skip() needs to know \$how_many tests are in the block" unless $tb->has_plan eq 'no_plan'; @@ -1468,7 +1433,7 @@ but want to put tests in your testing script (always a good idea). =item B - BAIL_OUT($reason); + BAIL_OUT($reason?); Indicates to the harness that things are going so badly all testing should terminate. This includes the running of any additional test scripts. @@ -1483,11 +1448,8 @@ For even better control look at L. =cut -sub BAIL_OUT { - my $reason = shift; - my $tb = Test::More->builder; - - $tb->BAIL_OUT($reason); +sub BAIL_OUT (str $reason="") { + Test::More->builder->BAIL_OUT($reason); } =back @@ -1528,8 +1490,8 @@ sub eq_array { _deep_check(@_); } -sub _eq_array { - my( $a1, $a2 ) = @_; +#sub _eq_array ( \@a1, \@a2 ) { +sub _eq_array ( $a1, $a2 ) { if( grep _type($_) ne 'ARRAY', $a1, $a2 ) { warn "eq_array passed a non-array ref"; @@ -1556,8 +1518,7 @@ sub _eq_array { return $ok; } -sub _equal_nonrefs { - my( $e1, $e2 ) = @_; +sub _equal_nonrefs ( $e1?, $e2? ) { return if ref $e1 or ref $e2; @@ -1571,10 +1532,8 @@ sub _equal_nonrefs { return; } -sub _deep_check { - my( $e1, $e2 ) = @_; +sub _deep_check ( $e1?, $e2? ) { my $tb = Test::More->builder; - my $ok = 0; # Effectively turn %Refs_Seen into a stack. This avoids picking up @@ -1650,9 +1609,8 @@ sub _deep_check { return $ok; } -sub _whoa { - my( $check, $desc ) = @_; - if($check) { +sub _whoa ( int $check, str $desc ) { + if ($check) { die <<"WHOA"; WHOA! $desc This should never happen! Please contact the author immediately! @@ -1667,15 +1625,17 @@ WHOA Determines if the two hashes contain the same keys and values. This is a deep check. +A third argument is currently ignored. + =cut -sub eq_hash { +sub eq_hash ($h1?, $h2?, $?) { local @Data_Stack = (); - return _deep_check(@_); + return _deep_check($h1, $h2); } -sub _eq_hash { - my( $a1, $a2 ) = @_; +#sub _eq_hash (\%a1, \%a2) { +sub _eq_hash ($a1, $a2) { if( grep _type($_) ne 'HASH', $a1, $a2 ) { warn "eq_hash passed a non-hash ref"; @@ -1704,7 +1664,7 @@ sub _eq_hash { =item B - my $is_eq = eq_set(\@got, \@expected); + my $is_eq = eq_set(\@got, \@expected, [$desc]); Similar to C, except the order of the elements is B important. This is a deep check, but the irrelevancy of order only @@ -1726,10 +1686,12 @@ level. The following is an example of a comparison which might not work: L contains much better set comparison functions. +The third argument is currently ignored. + =cut -sub eq_set { - my( $a1, $a2 ) = @_; +#sub eq_set ( \@a1, \@a2 ) { +sub eq_set ( $a1, $a2, $desc? ) { return 0 unless @$a1 == @$a2; no warnings 'uninitialized'; @@ -1746,8 +1708,8 @@ sub eq_set { # I don't know how references would be sorted so we just don't sort # them. This means eq_set doesn't really work with refs. return eq_array( - [ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ], - [ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ], + [ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ], + [ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ], ); } @@ -1968,6 +1930,8 @@ from Joshua Pritikin's Test module and lots of help from Barrie Slaymaker, Tony Bowden, blackstar.co.uk, chromatic, Fergal Daly and the perl-qa gang. +Modernized by Reini Urban for cperl signatures. + =head1 MAINTAINERS =over 4 @@ -1991,6 +1955,7 @@ F. =head1 COPYRIGHT Copyright 2001-2008 by Michael G Schwern Eschwern@pobox.comE. +Copyright 2015 cPanel Inc This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/dist/Test-Simple/lib/Test/Simple.pm b/dist/Test-Simple/lib/Test/Simple.pm index 187a3d25b08..fe4767133df 100644 --- a/dist/Test-Simple/lib/Test/Simple.pm +++ b/dist/Test-Simple/lib/Test/Simple.pm @@ -4,7 +4,8 @@ use 5.006; use strict; -our $VERSION = '1.302075'; +our $VERSION = '1.402075c'; +$VERSION =~ s/c$//; use Test::Builder::Module; our @ISA = qw(Test::Builder::Module); diff --git a/dist/Test-Simple/t/Legacy/BEGIN_require_ok.t b/dist/Test-Simple/t/Legacy/BEGIN_require_ok.t index 733d0bb861c..0a732640654 100644 --- a/dist/Test-Simple/t/Legacy/BEGIN_require_ok.t +++ b/dist/Test-Simple/t/Legacy/BEGIN_require_ok.t @@ -7,8 +7,7 @@ use strict; BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/BEGIN_use_ok.t b/dist/Test-Simple/t/Legacy/BEGIN_use_ok.t index 476badf7a29..d0d8e1b5a83 100644 --- a/dist/Test-Simple/t/Legacy/BEGIN_use_ok.t +++ b/dist/Test-Simple/t/Legacy/BEGIN_use_ok.t @@ -6,8 +6,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/Builder/details.t b/dist/Test-Simple/t/Legacy/Builder/details.t index 05d4828b4d9..a13641cae62 100644 --- a/dist/Test-Simple/t/Legacy/Builder/details.t +++ b/dist/Test-Simple/t/Legacy/Builder/details.t @@ -40,7 +40,7 @@ SKIP: { } push @Expected_Details, { 'ok' => 1, actual_ok => 1, - name => '', + name => undef, type => 'skip', reason => 'just testing skip', }; diff --git a/dist/Test-Simple/t/Legacy/More.t b/dist/Test-Simple/t/Legacy/More.t index ce535e26d99..3d9f3ee614b 100644 --- a/dist/Test-Simple/t/Legacy/More.t +++ b/dist/Test-Simple/t/Legacy/More.t @@ -2,13 +2,12 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = qw(../lib ../lib/Test/Simple/t/lib); + @INC = qw(../../lib t/lib); } } use lib 't/lib'; -use Test::More tests => 54; +use Test::More tests => 53; # Make sure we don't mess with $@ or $!. Test at bottom. my $Err = "this should not be touched"; @@ -24,7 +23,7 @@ require_ok('Test::More'); ok( 2 eq 2, 'two is two is two is two' ); is( "foo", "foo", 'foo is foo' ); isnt( "foo", "bar", 'foo isnt bar'); -isn't("foo", "bar", 'foo isn\'t bar'); +#isn't("foo", "bar", 'foo isn\'t bar'); #'# like("fooble", '/^foo/', 'foo is like fooble'); diff --git a/dist/Test-Simple/t/Legacy/bad_plan.t b/dist/Test-Simple/t/Legacy/bad_plan.t index 80e0e65bcaa..d2d48b6103e 100644 --- a/dist/Test-Simple/t/Legacy/bad_plan.t +++ b/dist/Test-Simple/t/Legacy/bad_plan.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/bail_out.t b/dist/Test-Simple/t/Legacy/bail_out.t index d1c3dce7219..701719e69c4 100644 --- a/dist/Test-Simple/t/Legacy/bail_out.t +++ b/dist/Test-Simple/t/Legacy/bail_out.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/buffer.t b/dist/Test-Simple/t/Legacy/buffer.t index 6039e4a6f72..51f24787ace 100644 --- a/dist/Test-Simple/t/Legacy/buffer.t +++ b/dist/Test-Simple/t/Legacy/buffer.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/capture.t b/dist/Test-Simple/t/Legacy/capture.t index f9103bd6aa0..1a20d79adc0 100644 --- a/dist/Test-Simple/t/Legacy/capture.t +++ b/dist/Test-Simple/t/Legacy/capture.t @@ -5,9 +5,7 @@ use Test::Tester; my $Test = Test::Builder->new; $Test->plan(tests => 3); -my $cap; - -$cap = Test::Tester->capture; +my $cap = Test::Tester->capture; { no warnings 'redefine'; diff --git a/dist/Test-Simple/t/Legacy/circular_data.t b/dist/Test-Simple/t/Legacy/circular_data.t index 2fd819e1f4a..928507bd215 100644 --- a/dist/Test-Simple/t/Legacy/circular_data.t +++ b/dist/Test-Simple/t/Legacy/circular_data.t @@ -4,8 +4,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/diag.t b/dist/Test-Simple/t/Legacy/diag.t index bc10975b113..32101f23e4c 100644 --- a/dist/Test-Simple/t/Legacy/diag.t +++ b/dist/Test-Simple/t/Legacy/diag.t @@ -14,8 +14,7 @@ BEGIN { BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/died.t b/dist/Test-Simple/t/Legacy/died.t index c26e86b541d..59a4784598c 100644 --- a/dist/Test-Simple/t/Legacy/died.t +++ b/dist/Test-Simple/t/Legacy/died.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/dont_overwrite_die_handler.t b/dist/Test-Simple/t/Legacy/dont_overwrite_die_handler.t index 09b700787d1..6e4cb749d38 100644 --- a/dist/Test-Simple/t/Legacy/dont_overwrite_die_handler.t +++ b/dist/Test-Simple/t/Legacy/dont_overwrite_die_handler.t @@ -3,8 +3,7 @@ use Config; # To prevent conflict with some strawberry-portable versions BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/eq_set.t b/dist/Test-Simple/t/Legacy/eq_set.t index fbdc52db1fa..bd0c8d6cce2 100644 --- a/dist/Test-Simple/t/Legacy/eq_set.t +++ b/dist/Test-Simple/t/Legacy/eq_set.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/exit.t b/dist/Test-Simple/t/Legacy/exit.t index e32e986314c..bc492bee232 100644 --- a/dist/Test-Simple/t/Legacy/exit.t +++ b/dist/Test-Simple/t/Legacy/exit.t @@ -5,8 +5,7 @@ package My::Test; BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/explain.t b/dist/Test-Simple/t/Legacy/explain.t index cf2f550e950..73665e2da6b 100644 --- a/dist/Test-Simple/t/Legacy/explain.t +++ b/dist/Test-Simple/t/Legacy/explain.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/extra.t b/dist/Test-Simple/t/Legacy/extra.t index 55a0007d49d..b6bf4d75daa 100644 --- a/dist/Test-Simple/t/Legacy/extra.t +++ b/dist/Test-Simple/t/Legacy/extra.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/extra_one.t b/dist/Test-Simple/t/Legacy/extra_one.t index d77404e15de..f9e673ec561 100644 --- a/dist/Test-Simple/t/Legacy/extra_one.t +++ b/dist/Test-Simple/t/Legacy/extra_one.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/fail-like.t b/dist/Test-Simple/t/Legacy/fail-like.t index 6545507e3a8..730b7a0a75f 100644 --- a/dist/Test-Simple/t/Legacy/fail-like.t +++ b/dist/Test-Simple/t/Legacy/fail-like.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; @@ -58,14 +57,14 @@ ERR } { - # line 62 + # line 61 like("foo", "not a regex"); $TB->is_eq($out->read, <is_eq($err->read, <create; -$TB->plan(tests => 80); +$TB->plan(tests => 78); sub like ($$;$) { $TB->like(@_); @@ -131,15 +130,15 @@ OUT ERR #line 132 -isn't("foo", "foo",'foo isn\'t foo?' ); -out_ok( < 1; use Dev::Null; diff --git a/dist/Test-Simple/t/Legacy/harness_active.t b/dist/Test-Simple/t/Legacy/harness_active.t index 7b027a7b404..c53a1d82f99 100644 --- a/dist/Test-Simple/t/Legacy/harness_active.t +++ b/dist/Test-Simple/t/Legacy/harness_active.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/import.t b/dist/Test-Simple/t/Legacy/import.t index 68a36138bc9..7b04ee1edfd 100644 --- a/dist/Test-Simple/t/Legacy/import.t +++ b/dist/Test-Simple/t/Legacy/import.t @@ -1,7 +1,6 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/is_deeply_dne_bug.t b/dist/Test-Simple/t/Legacy/is_deeply_dne_bug.t index f4578a6460e..be00a8ed664 100644 --- a/dist/Test-Simple/t/Legacy/is_deeply_dne_bug.t +++ b/dist/Test-Simple/t/Legacy/is_deeply_dne_bug.t @@ -7,8 +7,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/is_deeply_fail.t b/dist/Test-Simple/t/Legacy/is_deeply_fail.t index 21efe87a257..072517c822d 100644 --- a/dist/Test-Simple/t/Legacy/is_deeply_fail.t +++ b/dist/Test-Simple/t/Legacy/is_deeply_fail.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/is_deeply_with_threads.t b/dist/Test-Simple/t/Legacy/is_deeply_with_threads.t index 566da7eaa2e..e61fab70a8d 100644 --- a/dist/Test-Simple/t/Legacy/is_deeply_with_threads.t +++ b/dist/Test-Simple/t/Legacy/is_deeply_with_threads.t @@ -4,8 +4,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/missing.t b/dist/Test-Simple/t/Legacy/missing.t index 3b8f1fa9b4b..2839c5466c9 100644 --- a/dist/Test-Simple/t/Legacy/missing.t +++ b/dist/Test-Simple/t/Legacy/missing.t @@ -1,8 +1,7 @@ # HARNESS-NO-PRELOAD BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/new_ok.t b/dist/Test-Simple/t/Legacy/new_ok.t index d53f535d1c0..576f8b9ac13 100644 --- a/dist/Test-Simple/t/Legacy/new_ok.t +++ b/dist/Test-Simple/t/Legacy/new_ok.t @@ -36,7 +36,6 @@ use Test::More tests => 13; } # And what if we give it nothing? -eval { - new_ok(); -}; -is $@, sprintf "new_ok() must be given at least a class at %s line %d.\n", $0, __LINE__ - 2; +eval q(new_ok();); +like $@, qr/Not enough arguments for subroutine entry Test::More::new_ok\. Missing \$class at \(eval \d\) line 1, near "\(\)"\n/; +#is $@, sprintf "new_ok() must be given at least a class at %s line %d.\n", $0, __LINE__ - 2; diff --git a/dist/Test-Simple/t/Legacy/no_plan.t b/dist/Test-Simple/t/Legacy/no_plan.t index 5f392e40e1f..7169f28b6f4 100644 --- a/dist/Test-Simple/t/Legacy/no_plan.t +++ b/dist/Test-Simple/t/Legacy/no_plan.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/no_tests.t b/dist/Test-Simple/t/Legacy/no_tests.t index 997add59b2e..a8cbc9a6009 100644 --- a/dist/Test-Simple/t/Legacy/no_tests.t +++ b/dist/Test-Simple/t/Legacy/no_tests.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/note.t b/dist/Test-Simple/t/Legacy/note.t index fb98fb40295..50e70c21c11 100644 --- a/dist/Test-Simple/t/Legacy/note.t +++ b/dist/Test-Simple/t/Legacy/note.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/overload.t b/dist/Test-Simple/t/Legacy/overload.t index a86103746b3..b9cc871d192 100644 --- a/dist/Test-Simple/t/Legacy/overload.t +++ b/dist/Test-Simple/t/Legacy/overload.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/overload_threads.t b/dist/Test-Simple/t/Legacy/overload_threads.t index 56bdaec5bc9..ae1bc1f5dce 100644 --- a/dist/Test-Simple/t/Legacy/overload_threads.t +++ b/dist/Test-Simple/t/Legacy/overload_threads.t @@ -3,8 +3,7 @@ use Test2::Util qw/CAN_THREAD/; BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/plan.t b/dist/Test-Simple/t/Legacy/plan.t index 0d3ce89edb1..0814f997d9b 100644 --- a/dist/Test-Simple/t/Legacy/plan.t +++ b/dist/Test-Simple/t/Legacy/plan.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/plan_bad.t b/dist/Test-Simple/t/Legacy/plan_bad.t index 179356dbc1d..63814a5d5fe 100644 --- a/dist/Test-Simple/t/Legacy/plan_bad.t +++ b/dist/Test-Simple/t/Legacy/plan_bad.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } @@ -19,7 +18,7 @@ is $@, sprintf "Number of tests must be a positive integer. You gave it 'no_pla my $foo = []; my @foo = ($foo, 2, 3); ok !eval { $tb->plan( tests => @foo ) }; -is $@, sprintf "Number of tests must be a positive integer. You gave it '$foo' at %s line %d.\n", $0, __LINE__ - 1; +is $@, sprintf "Too many arguments for subroutine Test::Builder::plan. Want: 1-3, but got: 5 at %s line %d.\n", $0, __LINE__ - 1; ok !eval { $tb->plan( tests => 9.99 ) }; is $@, sprintf "Number of tests must be a positive integer. You gave it '9.99' at %s line %d.\n", $0, __LINE__ - 1; diff --git a/dist/Test-Simple/t/Legacy/plan_is_noplan.t b/dist/Test-Simple/t/Legacy/plan_is_noplan.t index 1e696042eff..1bd59fa667b 100644 --- a/dist/Test-Simple/t/Legacy/plan_is_noplan.t +++ b/dist/Test-Simple/t/Legacy/plan_is_noplan.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/plan_no_plan.t b/dist/Test-Simple/t/Legacy/plan_no_plan.t index 3111592e97f..ffb1d9c3845 100644 --- a/dist/Test-Simple/t/Legacy/plan_no_plan.t +++ b/dist/Test-Simple/t/Legacy/plan_no_plan.t @@ -1,7 +1,6 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/plan_shouldnt_import.t b/dist/Test-Simple/t/Legacy/plan_shouldnt_import.t index b6eb0642446..e75ec980250 100644 --- a/dist/Test-Simple/t/Legacy/plan_shouldnt_import.t +++ b/dist/Test-Simple/t/Legacy/plan_shouldnt_import.t @@ -4,8 +4,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/plan_skip_all.t b/dist/Test-Simple/t/Legacy/plan_skip_all.t index 528df5f50d4..f4bcf69a61e 100644 --- a/dist/Test-Simple/t/Legacy/plan_skip_all.t +++ b/dist/Test-Simple/t/Legacy/plan_skip_all.t @@ -1,7 +1,6 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/require_ok.t b/dist/Test-Simple/t/Legacy/require_ok.t index 463a007599c..ee6454c0cbf 100644 --- a/dist/Test-Simple/t/Legacy/require_ok.t +++ b/dist/Test-Simple/t/Legacy/require_ok.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/simple.t b/dist/Test-Simple/t/Legacy/simple.t index 7297e9d6dd1..7b15d184e19 100644 --- a/dist/Test-Simple/t/Legacy/simple.t +++ b/dist/Test-Simple/t/Legacy/simple.t @@ -1,7 +1,6 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/skip.t b/dist/Test-Simple/t/Legacy/skip.t index f2ea9fbf201..dbcc16e64e8 100644 --- a/dist/Test-Simple/t/Legacy/skip.t +++ b/dist/Test-Simple/t/Legacy/skip.t @@ -2,12 +2,11 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } -use Test::More tests => 17; +use Test::More tests => 15; # If we skip with the same name, Test::Harness will report it back and # we won't get lots of false bug reports. @@ -84,15 +83,16 @@ SKIP: { pass("This is supposed to run, too"); } -{ - my $warning = ''; - local $SIG{__WARN__} = sub { $warning .= join "", @_ }; - - SKIP: { - skip 1, "This is backwards" if 1; - - pass "This does not run"; - } - - like $warning, qr/^skip\(\) was passed a non-numeric number of tests/; -} +# with cperl types this is a compile-time error +#{ +# my $warning = ''; +# local $SIG{__WARN__} = sub { $warning .= join "", @_ }; +# +# SKIP: { +# skip 1, "This is backwards" if 1; +# +# pass "This does not run"; +# } +# +# like $warning, qr/^skip\(\) was passed a non-numeric number of tests/; +#} diff --git a/dist/Test-Simple/t/Legacy/skipall.t b/dist/Test-Simple/t/Legacy/skipall.t index 5491be126e8..fbe71612dc3 100644 --- a/dist/Test-Simple/t/Legacy/skipall.t +++ b/dist/Test-Simple/t/Legacy/skipall.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/subtest/args.t b/dist/Test-Simple/t/Legacy/subtest/args.t index 2c489a7b963..8b5e0a2e020 100644 --- a/dist/Test-Simple/t/Legacy/subtest/args.t +++ b/dist/Test-Simple/t/Legacy/subtest/args.t @@ -17,9 +17,10 @@ use Test::Builder::NoOutput; my $tb = Test::Builder->new; $tb->ok( !eval { $tb->subtest() } ); -$tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); +#old error: subtest()'s second argument must be a code ref +#new better error: Not enough arguments for subroutine Test::Builder::subtest. Want: 3, but got: 0 -$tb->ok( !eval { $tb->subtest("foo") } ); +$tb->ok( !eval { $tb->subtest("foo", undef) } ); $tb->like( $@, qr/^\Qsubtest()'s second argument must be a code ref/ ); my $foo; diff --git a/dist/Test-Simple/t/Legacy/subtest/fork.t b/dist/Test-Simple/t/Legacy/subtest/fork.t index aaa6cab877b..d2d59108aa5 100644 --- a/dist/Test-Simple/t/Legacy/subtest/fork.t +++ b/dist/Test-Simple/t/Legacy/subtest/fork.t @@ -13,24 +13,29 @@ BEGIN { use IO::Pipe; use Test::Builder; use Test::More; +use Config; plan 'tests' => 1; subtest 'fork within subtest' => sub { - plan tests => 2; + plan tests => 2; + + TODO: { + local $TODO = "random fork problem with MSVC" + if ($^O eq 'MSWin32' and $Config{cc} eq 'cl'); my $pipe = IO::Pipe->new; my $pid = fork; defined $pid or plan skip_all => "Fork not working"; if ($pid) { - $pipe->reader; - my $child_output = do { local $/ ; <$pipe> }; - waitpid $pid, 0; + $pipe->reader; + my $child_output = do { local $/ ; <$pipe> }; + waitpid $pid, 0; - is $?, 0, 'child exit status'; - like $child_output, qr/^[\s#]+Child Done\s*\z/, 'child output'; - } + is $?, 0, 'child exit status'; + like $child_output, qr/^[\s#]+Child Done\s*\z/, 'child output'; + } else { $pipe->writer; @@ -44,5 +49,6 @@ subtest 'fork within subtest' => sub { diag 'Child Done'; exit 0; } + } }; diff --git a/dist/Test-Simple/t/Legacy/subtest/plan.t b/dist/Test-Simple/t/Legacy/subtest/plan.t index 7e944ab2833..215fcd8c68c 100644 --- a/dist/Test-Simple/t/Legacy/subtest/plan.t +++ b/dist/Test-Simple/t/Legacy/subtest/plan.t @@ -15,14 +15,13 @@ use warnings; use Test::Builder::NoOutput; -use Test::More tests => 6; +use Test::More tests => 5; # Formatting may change if we're running under Test::Harness. $ENV{HARNESS_ACTIVE} = 0; { ok defined &subtest, 'subtest() should be exported to our namespace'; - is prototype('subtest'), undef, '... has no prototype'; subtest 'subtest with plan', sub { plan tests => 2; diff --git a/dist/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t b/dist/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t index 8bdd17753b1..a2f7dffef34 100644 --- a/dist/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t +++ b/dist/Test-Simple/t/Legacy/tbm_doesnt_set_exported_to.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/todo.t b/dist/Test-Simple/t/Legacy/todo.t index 7d28846857f..231461471c4 100644 --- a/dist/Test-Simple/t/Legacy/todo.t +++ b/dist/Test-Simple/t/Legacy/todo.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/undef.t b/dist/Test-Simple/t/Legacy/undef.t index 2c8cace491a..23aae20944b 100644 --- a/dist/Test-Simple/t/Legacy/undef.t +++ b/dist/Test-Simple/t/Legacy/undef.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ('../../lib', 't/lib'); } else { unshift @INC, 't/lib'; diff --git a/dist/Test-Simple/t/Legacy/useing.t b/dist/Test-Simple/t/Legacy/useing.t index c4ce5071270..220ce2ebdda 100644 --- a/dist/Test-Simple/t/Legacy/useing.t +++ b/dist/Test-Simple/t/Legacy/useing.t @@ -1,7 +1,6 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } } diff --git a/dist/Test-Simple/t/Legacy/utf8.t b/dist/Test-Simple/t/Legacy/utf8.t index 2930226e3e9..274be71c5e5 100644 --- a/dist/Test-Simple/t/Legacy/utf8.t +++ b/dist/Test-Simple/t/Legacy/utf8.t @@ -2,8 +2,7 @@ BEGIN { if( $ENV{PERL_CORE} ) { - chdir 't'; - @INC = '../lib'; + @INC = '../../lib'; } }