From: Michael G. Schwern Date: Sun, 10 Mar 2002 19:22:33 +0000 (-0500) Subject: Test::Simple/More/Builder 0.42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6686786d9838c86b02dc454606aff018ec114f7b;p=p5sagit%2Fp5-mst-13.2.git Test::Simple/More/Builder 0.42 Message-ID: <20020311002233.GE4927@blackrider> p4raw-id: //depot/perl@15157 --- diff --git a/lib/Test/Builder.pm b/lib/Test/Builder.pm index 2d8eddd..da63506 100644 --- a/lib/Test/Builder.pm +++ b/lib/Test/Builder.pm @@ -8,7 +8,7 @@ $^C ||= 0; use strict; use vars qw($VERSION $CLASS); -$VERSION = '0.11'; +$VERSION = '0.12'; $CLASS = __PACKAGE__; my $IsVMS = $^O eq 'VMS'; @@ -934,6 +934,11 @@ sub current_test { if( defined $num ) { $Curr_Test = $num; + if( $num > @Test_Results ) { + for ($#Test_Results..$num-1) { + $Test_Results[$_] = 1; + } + } } return $Curr_Test; } diff --git a/lib/Test/More.pm b/lib/Test/More.pm index 4b03dff..5cd8901 100644 --- a/lib/Test/More.pm +++ b/lib/Test/More.pm @@ -18,7 +18,7 @@ sub _carp { require Exporter; use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO); -$VERSION = '0.41'; +$VERSION = '0.42'; @ISA = qw(Exporter); @EXPORT = qw(ok use_ok require_ok is isnt like unlike is_deeply @@ -198,7 +198,7 @@ sub import { =head2 Test names By convention, each test is assigned a number in order. This is -largely done automatically for you. However, its often very useful to +largely done automatically for you. However, it's often very useful to assign a name to each test. Which would you rather see: ok 4 @@ -215,7 +215,7 @@ The later gives you some idea of what failed. It also makes it easier to find the test in your script, simply search for "simple exponential". -All test functions take a name argument. Its optional, but highly +All test functions take a name argument. It's optional, but highly suggested that you use it. @@ -412,7 +412,7 @@ and $that were: # && # undef -Its also useful in those cases where you are comparing numbers and +It's also useful in those cases where you are comparing numbers and is()'s use of C will interfere: cmp_ok( $big_hairy_number, '==', $another_big_hairy_number ); @@ -472,7 +472,7 @@ sub can_ok ($@) { } my $name; - $name = @methods == 1 ? "$class->can($methods[0])" + $name = @methods == 1 ? "$class->can('$methods[0]')" : "$class->can(...)"; my $ok = $Test->ok( !@nok, $name ); @@ -531,7 +531,7 @@ sub isa_ok ($$;$) { if( $@ =~ /^Can't call method "isa" on unblessed reference/ ) { if( !UNIVERSAL::isa($object, $class) ) { my $ref = ref $object; - $diag = "$obj_name isn't a '$class' its a '$ref'"; + $diag = "$obj_name isn't a '$class' it's a '$ref'"; } } else { die <current_test() now works (see what happens + when you forget to test things?) + - The change in is()'s undef/'' handling in 0.34 was an API change, + but I forgot to declare it as such. + - The apostrophilic jihad attacks! Philip Newtons patch for + grammar mistakes in the doc's. + 0.41 Mon Dec 17 22:45:20 EST 2001 * chromatic added diag() - Internal eval()'s sometimes interfering with $@ and $!. Fixed. @@ -26,7 +34,8 @@ Revision history for Perl extension Test::Simple - Little glitch in the test suite. No actual bug. 0.34 Tue Nov 27 15:43:56 EST 2001 - * Empty string no longer matches undef in is() and isnt(). + * **API CHANGE** Empty string no longer matches undef in is() + and isnt(). * Added isnt_eq and isnt_num to Test::Builder. 0.33 Mon Oct 22 21:05:47 EDT 2001 diff --git a/lib/Test/Simple/t/Builder.t b/lib/Test/Simple/t/Builder.t index 0ef079c..a5bfd15 100644 --- a/lib/Test/Simple/t/Builder.t +++ b/lib/Test/Simple/t/Builder.t @@ -10,7 +10,7 @@ BEGIN { use Test::Builder; my $Test = Test::Builder->new; -$Test->plan( tests => 4 ); +$Test->plan( tests => 7 ); my $default_lvl = $Test->level; $Test->level(0); @@ -21,3 +21,10 @@ $Test->ok( $default_lvl == 1, 'level()' ); $Test->is_eq('foo', 'foo', 'is_eq'); $Test->is_num('23.0', '23', 'is_num'); +$Test->is_num( $Test->current_test, 4, 'current_test() get' ); + +my $test_num = $Test->current_test + 1; +$Test->current_test( $test_num ); +print "ok $test_num - current_test() set\n"; + +$Test->ok( 1, 'counter still good' ); diff --git a/lib/Test/Simple/t/fail-more.t b/lib/Test/Simple/t/fail-more.t index 6fd88c8..29f8eb2 100644 --- a/lib/Test/Simple/t/fail-more.t +++ b/lib/Test/Simple/t/fail-more.t @@ -165,13 +165,13 @@ OUT # Failed test ($0 at line 53) # can_ok() called with no methods # Failed test ($0 at line 55) -# The object isn't a 'Wibble' its a 'Foo' +# The object isn't a 'Wibble' it's a 'Foo' # Failed test ($0 at line 56) # My Wibble isn't a reference # Failed test ($0 at line 57) # Another Wibble isn't defined # Failed test ($0 at line 58) -# The object isn't a 'HASH' its a 'ARRAY' +# The object isn't a 'HASH' it's a 'ARRAY' # Failed test ($0 at line 68) # got: 'foo' # expected: 'bar'