From c8c139910f0949c2e0a1fa2819c15d4c834fa5cd Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Wed, 23 Feb 2011 10:20:34 +0000 Subject: [PATCH] Update Test-Simple to CPAN version 0.98 [DELTA] 0.98 Wed, 23 Feb 2011 14:38:02 +1100 Bug Fixes * subtest() should not fail if $? is non-zero. (Aaron Crane) Docs * The behavior of is() and undef has been documented. (Pedro Melo) --- MANIFEST | 1 + Porting/Maintainers.pl | 2 +- cpan/Test-Simple/Changes | 8 ++++++++ cpan/Test-Simple/lib/Test/Builder.pm | 8 +++++++- cpan/Test-Simple/lib/Test/Builder/Module.pm | 4 ++-- cpan/Test-Simple/lib/Test/Builder/Tester.pm | 2 +- cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm | 2 +- cpan/Test-Simple/lib/Test/More.pm | 7 ++++++- cpan/Test-Simple/lib/Test/Simple.pm | 2 +- cpan/Test-Simple/t/is_deeply_fail.t | 2 +- cpan/Test-Simple/t/subtest/wstat.t | 24 +++++++++++++++++++++++ pod/perldelta.pod | 12 ++++++++++-- 12 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 cpan/Test-Simple/t/subtest/wstat.t diff --git a/MANIFEST b/MANIFEST index 756dd7c..e63078e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2419,6 +2419,7 @@ cpan/Test-Simple/t/subtest/plan.t Test::Builder tests cpan/Test-Simple/t/subtest/predicate.t Test::Builder tests cpan/Test-Simple/t/subtest/singleton.t Test::More test cpan/Test-Simple/t/subtest/todo.t Test::Builder tests +cpan/Test-Simple/t/subtest/wstat.t Test::More test cpan/Test-Simple/t/tbm_doesnt_set_exported_to.t Test::Builder::Module test cpan/Test-Simple/t/Tester/tbt_01basic.t Test::Builder::Tester test cpan/Test-Simple/t/Tester/tbt_02fhrestore.t Test::Builder::Tester test diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index f694bce..a68be5f 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1442,7 +1442,7 @@ use File::Glob qw(:case); 'Test::Simple' => { 'MAINTAINER' => 'mschwern', - 'DISTRIBUTION' => 'MSCHWERN/Test-Simple-0.97_01.tar.gz', + 'DISTRIBUTION' => 'MSCHWERN/Test-Simple-0.98.tar.gz', 'FILES' => q[cpan/Test-Simple], 'EXCLUDED' => [ qw{.perlcriticrc diff --git a/cpan/Test-Simple/Changes b/cpan/Test-Simple/Changes index 72fb566..b60952e 100644 --- a/cpan/Test-Simple/Changes +++ b/cpan/Test-Simple/Changes @@ -1,3 +1,11 @@ +0.98 Wed, 23 Feb 2011 14:38:02 +1100 + Bug Fixes + * subtest() should not fail if $? is non-zero. (Aaron Crane) + + Docs + * The behavior of is() and undef has been documented. (Pedro Melo) + + 0.97_01 Fri Aug 27 22:50:30 PDT 2010 Test Fixes * Adapted the tests for the new Perl 5.14 regex stringification. diff --git a/cpan/Test-Simple/lib/Test/Builder.pm b/cpan/Test-Simple/lib/Test/Builder.pm index 937c45d..cb4335f 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 = '0.97_01'; +our $VERSION = '0.98'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) BEGIN { @@ -312,6 +312,8 @@ sub finalize { if( $self->{Child_Name} ) { $self->croak("Can't call finalize() with child ($self->{Child_Name}) active"); } + + local $? = 0; # don't fail if $subtests happened to set $? nonzero $self->_ending; # XXX This will only be necessary for TAP envelopes (we think) @@ -923,6 +925,8 @@ sub _is_dualvar { Like Test::More's C. Checks if C<$got eq $expected>. This is the string version. +C only ever matches another C. + =item B $Test->is_num($got, $expected, $name); @@ -930,6 +934,8 @@ string version. Like Test::More's C. Checks if C<$got == $expected>. This is the numeric version. +C only ever matches another C. + =cut sub is_eq { diff --git a/cpan/Test-Simple/lib/Test/Builder/Module.pm b/cpan/Test-Simple/lib/Test/Builder/Module.pm index c78265a..12a1e61 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 = '0.97_01'; +our $VERSION = '0.98'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) @@ -58,7 +58,7 @@ the plan independent of Test::More. All arguments passed to import() are passed onto C<< Your::Module->builder->plan() >> with the exception of -C[qw(things to import)]>. +C<< import =>[qw(things to import)] >>. use Your::Module import => [qw(this that)], tests => 23; diff --git a/cpan/Test-Simple/lib/Test/Builder/Tester.pm b/cpan/Test-Simple/lib/Test/Builder/Tester.pm index a2c1fc5..793139f 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.21_01"; +our $VERSION = "1.22"; 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 cae0cc2..9fb6cf1 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.21_01"; +our $VERSION = "1.22"; require Test::Builder::Tester; diff --git a/cpan/Test-Simple/lib/Test/More.pm b/cpan/Test-Simple/lib/Test/More.pm index fd2754e..c1f5bf1 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 = '0.97_01'; +our $VERSION = '0.98'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Builder::Module; @@ -317,6 +317,11 @@ are similar to these: ok( ultimate_answer() eq 42, "Meaning of Life" ); ok( $foo ne '', "Got some foo" ); +C will only ever match C. So you can test a value +agains C like this: + + is($not_defined, undef, "undefined as expected"); + (Mnemonic: "This is that." "This isn't that.") So why use these? They produce better diagnostics on failure. ok() diff --git a/cpan/Test-Simple/lib/Test/Simple.pm b/cpan/Test-Simple/lib/Test/Simple.pm index d9e2a47..1a85d36 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 = '0.97_01'; +our $VERSION = '0.98'; $VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) use Test::Builder::Module; diff --git a/cpan/Test-Simple/t/is_deeply_fail.t b/cpan/Test-Simple/t/is_deeply_fail.t index 508edd7..fc1c6b6 100644 --- a/cpan/Test-Simple/t/is_deeply_fail.t +++ b/cpan/Test-Simple/t/is_deeply_fail.t @@ -418,4 +418,4 @@ ERR is( $out, "not ok 40 - {x => 0} != {x => undef}\n" ); ok !is_deeply( {x => ''}, {x => undef}, "{x => ''} != {x => undef}" ); is( $out, "not ok 41 - {x => ''} != {x => undef}\n" ); -} +} \ No newline at end of file diff --git a/cpan/Test-Simple/t/subtest/wstat.t b/cpan/Test-Simple/t/subtest/wstat.t new file mode 100644 index 0000000..ee2f198 --- /dev/null +++ b/cpan/Test-Simple/t/subtest/wstat.t @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w + +# Test that setting $? doesn't affect subtest success + +use strict; +use Test::More; + +subtest foo => sub { + plan tests => 1; + $? = 1; + pass('bar'); +}; + +is $?, 1, "exit code keeps on from a subtest"; + +subtest foo2 => sub { + plan tests => 1; + pass('bar2'); + $? = 1; +}; + +is $?, 1, "exit code keeps on from a subtest"; + +done_testing(4); diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 7af7ce6..4a97c30 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -96,11 +96,19 @@ XXX =item * +C has been upgraded from version 1.25_03 to 1.25_04. + +=item * + C has been upgraded from version 2.27103 to 2.27104 =item * -C has been upgraded from version 1.25_03 to 1.25_04. +C has been upgraded from version 3.22 to 3.23 + +=item * + +C has been upgraded from version 0.97_01 to 0.98 =back @@ -110,7 +118,7 @@ C has been upgraded from version 1.25_03 to 1.25_04. =item * -C has been upgraded from version 3.22 to 3.23 +XXX =back -- 2.7.4