Change 28514 by [EMAIL PROTECTED] on 2006/07/09 13:51:37

        Upgrade to Test-Simple-0.63

Affected files ...

... //depot/perl/lib/Test/Builder.pm#16 edit
... //depot/perl/lib/Test/Builder/Tester.pm#2 edit
... //depot/perl/lib/Test/More.pm#26 edit
... //depot/perl/lib/Test/Simple.pm#20 edit
... //depot/perl/lib/Test/Simple/Changes#17 edit
... //depot/perl/lib/Test/Simple/t/fail-more.t#12 edit
... //depot/perl/lib/Test/Simple/t/tbt_01basic.t#4 edit
... //depot/perl/lib/Test/Simple/t/tbt_05faildiag.t#3 edit

Differences ...

==== //depot/perl/lib/Test/Builder.pm#16 (text) ====
Index: perl/lib/Test/Builder.pm
--- perl/lib/Test/Builder.pm#15~25718~  2005-10-09 08:24:43.000000000 -0700
+++ perl/lib/Test/Builder.pm    2006-07-09 06:51:37.000000000 -0700
@@ -8,7 +8,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33';
 $VERSION = eval $VERSION;    # make the alpha version come out as a number
 
 # Make Test::Builder thread-safe for ithreads.
@@ -605,7 +605,7 @@
 
 =item B<isnt_num>
 
-  $Test->is_num($got, $dont_expect, $name);
+  $Test->isnt_num($got, $dont_expect, $name);
 
 Like Test::More's isnt().  Checks if $got ne $dont_expect.  This is
 the numeric version.

==== //depot/perl/lib/Test/Builder/Tester.pm#2 (text) ====
Index: perl/lib/Test/Builder/Tester.pm
--- perl/lib/Test/Builder/Tester.pm#1~25718~    2005-10-09 08:24:43.000000000 
-0700
+++ perl/lib/Test/Builder/Tester.pm     2006-07-09 06:51:37.000000000 -0700
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw(@EXPORT $VERSION @ISA);
-$VERSION = "1.02";
+$VERSION = "1.03";
 
 use Test::Builder;
 use Symbol;
@@ -18,11 +18,21 @@
     use Test::Builder::Tester tests => 1;
     use Test::More;
 
-    test_out("not ok 1 - foo");
-    test_fail(+1);
+    test_fail(+1, "foo");
     fail("foo");
     test_test("fail works");
 
+    test_pass("baz");
+    ok(1, "baz");
+    test_test("pass works");
+
+    test_fail(+3, "is foo bar?");
+    test_err("#          got: 'foo'",
+             "#     expected: 'bar'");
+    is("foo", "bar", "is foo bar?");
+    test_test("diagnostic checking works");
+
+
 =head1 DESCRIPTION
 
 A module that helps you test testing modules that are built with
@@ -30,8 +40,8 @@
 
 The testing system is designed to be used by performing a three step
 process for each test you wish to test.  This process starts with using
-C<test_out> and C<test_err> in advance to declare what the testsuite you
-are testing will output with B<Test::Builder> to stdout and stderr.
+Test::Builder::Tester functions to declare what the testsuite you
+are testing will output with B<Test::Builder>.
 
 You then can run the test(s) from your test suite that call
 B<Test::Builder>.  At this point the output of B<Test::Builder> is
@@ -58,7 +68,7 @@
 use Exporter;
 @ISA = qw(Exporter);
 
[EMAIL PROTECTED] = qw(test_out test_err test_fail test_diag test_test 
line_num);
[EMAIL PROTECTED] = qw(test_out test_err test_fail test_diag test_test line_num 
test_pass);
 
 # _export_to_level and import stolen directly from Test::More.  I am
 # the king of cargo cult programming ;-)
@@ -154,58 +164,46 @@
     $t->no_ending(1);
 }
 
-=head2 Methods
+=head2 Functions
 
-These are the six methods that are exported as default.
+These are the functions exported by default.
 
 =over 4
 
-=item test_out
+=item test_pass
 
-=item test_err
+    test_pass();
+    test_pass($description);
 
-Procedures for predeclaring the output that your test suite is
-expected to produce until C<test_test> is called.  These procedures
-automatically assume that each line terminates with "\n".  So
+Because the standard success message that B<Test::Builder> produces
+whenever a test passes will be common in your test error
+output, rather than forcing you to call C<test_out> with the string
+all the time like so
 
-   test_out("ok 1","ok 2");
+    test_out("ok 1 - some test name here");
 
-is the same as
+C<test_pass> exists as a convenience function that you can call instead.  It
+takes one optional argument, the test description from the test you expect to
+pass.  The following is equivalent to the above C<test_out> call.
 
-   test_out("ok 1\nok 2");
-
-which is even the same as
-
-   test_out("ok 1");
-   test_out("ok 2");
-
-Once C<test_out> or C<test_err> (or C<test_fail> or C<test_diag>) have
-been called once all further output from B<Test::Builder> will be
-captured by B<Test::Builder::Tester>.  This means that your will not
-be able perform further tests to the normal output in the normal way
-until you call C<test_test> (well, unless you manually meddle with the
-output filehandles)
+    test_pass("some test name here");
 
 =cut
 
-sub test_out(@)
+sub test_pass(;$)
 {
-    # do we need to do any setup?
-    _start_testing() unless $testing;
-
-    $out->expect(@_)
+    _start_testing() unless $testing++;
+    my $mess = "ok $testing";
+    $mess .= ' - ' . shift if @_;
+    $out->expect( $mess, @_ );
 }
 
-sub test_err(@)
-{
-    # do we need to do any setup?
-    _start_testing() unless $testing;
-
-    $err->expect(@_)
-}
 
 =item test_fail
 
+    test_fail($line_num_offset);
+    test_fail($line_num_offset, $description);
+
 Because the standard failure message that B<Test::Builder> produces
 whenever a test fails will be a common occurrence in your test error
 output, and because has changed between Test::Builder versions, rather
@@ -214,35 +212,86 @@
 
     test_err("# Failed test ($0 at line ".line_num(+1).")");
 
-C<test_fail> exists as a convenience method that can be called
+C<test_fail> exists as a convenience function that can be called
 instead.  It takes one argument, the offset from the current line that
 the line that causes the fail is on.
 
     test_fail(+1);
+    ok(0);
 
-This means that the example in the synopsis could be rewritten
-more simply as:
+It optionally takes the $description of the test.
 
-   test_out("not ok 1 - foo");
-   test_fail(+1);
-   fail("foo");
-   test_test("fail works");
+    test_fail(+1, "kaboom");
+    fail("kaboom");
 
 =cut
 
 sub test_fail
 {
     # do we need to do any setup?
-    _start_testing() unless $testing;
+    _start_testing() unless $testing++;
 
     # work out what line we should be on
     my ($package, $filename, $line) = caller;
     $line = $line + (shift() || 0); # prevent warnings
 
+    my $mess = "not ok $testing";
+    $mess .= ' - ' . shift if @_;
+    $out->expect( $mess );
+
     # expect that on stderr
     $err->expect("#     Failed test ($0 at line $line)");
 }
 
+
+=item test_out
+
+    test_out(@output);
+
+=item test_err
+
+    test_err(@diagnostic_output);
+
+Procedures for predeclaring the output that your test suite is
+expected to produce until C<test_test> is called.  These procedures
+automatically assume that each line terminates with "\n".  So
+
+   test_out("foo","bar");
+
+is the same as
+
+   test_out("foo\nbar");
+
+which is even the same as
+
+   test_out("foo");
+   test_out("bar");
+
+Once C<test_out> or C<test_err> (or C<test_fail>, C<test_pass>, or
+C<test_diag>) have been called once all further output from B<Test::Builder>
+will be captured by B<Test::Builder::Tester>.  This means that your will not be
+able perform further tests to the normal output in the normal way until you
+call C<test_test>.
+
+=cut
+
+sub test_out(@)
+{
+    # do we need to do any setup?
+    _start_testing() unless $testing;
+
+    $out->expect(@_)
+}
+
+sub test_err(@)
+{
+    # do we need to do any setup?
+    _start_testing() unless $testing;
+
+    $err->expect(@_)
+}
+
+
 =item test_diag
 
 As most of the remaining expected output to the error stream will be
@@ -358,7 +407,6 @@
                     && ($args{skip_err} || $err->check),
                    $mess))
     {
-      # print out the diagnostic information about why this
       # test failed
 
       local $_;
@@ -376,7 +424,7 @@
 A utility function that returns the line number that the function was
 called on.  You can pass it an offset which will be added to the
 result.  This is very useful for working out the correct text of
-diagnostic methods that contain line numbers.
+diagnostic functions that contain line numbers.
 
 Essentially this is the same as the C<__LINE__> macro, but the
 C<line_num(+3)> idiom is arguably nicer.
@@ -442,10 +490,10 @@
 
 =head1 BUGS
 
-Calls B<Test::Builder>'s C<no_ending> method turning off the ending
-tests.  This is needed as otherwise it will trip out because we've run
-more tests than we strictly should have and it'll register any
-failures we had that we were testing for as real failures.
+Calls C<<Test::Builder->no_ending>> turning off the ending tests.
+This is needed as otherwise it will trip out because we've run more
+tests than we strictly should have and it'll register any failures we
+had that we were testing for as real failures.
 
 The color function doesn't work unless B<Term::ANSIColor> is installed
 and is compatible with your terminal.
@@ -543,7 +591,7 @@
     my $self = shift;
     my $type   = $self->type;
     my $got    = $self->got;
-    my $wanted = join "\n", @{$self->wanted};
+    my $wanted = join '', @{$self->wanted};
 
     # are we running in colour mode?
     if (Test::Builder::Tester::color)

==== //depot/perl/lib/Test/More.pm#26 (text) ====
Index: perl/lib/Test/More.pm
--- perl/lib/Test/More.pm#25~25718~     2005-10-09 08:24:43.000000000 -0700
+++ perl/lib/Test/More.pm       2006-07-09 06:51:37.000000000 -0700
@@ -16,7 +16,7 @@
 
 
 use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
-$VERSION = '0.62';
+$VERSION = '0.63';
 $VERSION = eval $VERSION;    # make the alpha version come out as a number
 
 use Test::Builder::Module;
@@ -465,6 +465,12 @@
     my $class = ref $proto || $proto;
     my $tb = Test::More->builder;
 
+    unless( $class ) {
+        my $ok = $tb->ok( 0, "->can(...)" );
+        $tb->diag('    can_ok() called with empty class or reference');
+        return $ok;
+    }
+
     unless( @methods ) {
         my $ok = $tb->ok( 0, "$class->can(...)" );
         $tb->diag('    can_ok() called with no methods');
@@ -1107,7 +1113,7 @@
 
     BAIL_OUT($reason);
 
-Incidates to the harness that things are going so badly all testing
+Indicates to the harness that things are going so badly all testing
 should terminate.  This includes the running any additional test scripts.
 
 This is typically used when testing cannot continue such as a critical

==== //depot/perl/lib/Test/Simple.pm#20 (text) ====
Index: perl/lib/Test/Simple.pm
--- perl/lib/Test/Simple.pm#19~25718~   2005-10-09 08:24:43.000000000 -0700
+++ perl/lib/Test/Simple.pm     2006-07-09 06:51:37.000000000 -0700
@@ -4,7 +4,7 @@
 
 use strict 'vars';
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '0.62';
+$VERSION = '0.63';
 $VERSION = eval $VERSION;    # make the alpha version come out as a number
 
 use Test::Builder::Module;

==== //depot/perl/lib/Test/Simple/Changes#17 (text) ====
Index: perl/lib/Test/Simple/Changes
--- perl/lib/Test/Simple/Changes#16~25718~      2005-10-09 08:24:43.000000000 
-0700
+++ perl/lib/Test/Simple/Changes        2006-07-09 06:51:37.000000000 -0700
@@ -1,5 +1,21 @@
+0.63  Sun Jul  9 02:36:36 PDT 2006
+    * Fixed can_ok() to gracefully handle no class name.
+      Submitted by "Pete Krawczyk" <[EMAIL PROTECTED]>
+      Implemented by "Richard Foley" <[EMAIL PROTECTED]>
+      [rt.cpan.org 15654]
+    * Added test_pass() to Test::Builder::Tester rather than having to
+      call test_out("ok 1 - foo"). <[EMAIL PROTECTED]> [rt.cpan.org 11317]
+    * test_fail() now accepts a test diagnostic rather than having to
+      call test_out() separately. <[EMAIL PROTECTED]> [rt.cpan.org 11319]
+    - Changed Test::Builder::Tester docs to show best practice using
+      test_fail() and test_pass().
+    - isnt_num() doc example wrongly showed is_num(). <[EMAIL PROTECTED]>
+    - Fixed a minor typo in the BAIL_OUT() docs. <Jeff Deifik>
+    - Removed the LICENSE field from the Makefile.PL as the release of
+      MakeMaker with that feature has been delayed.
+
 0.62  Sat Oct  8 01:25:03 PDT 2005
-    * Aborbed Test::Builder::Tester.  The last release broke it because its
+    * Absorbed Test::Builder::Tester.  The last release broke it because its
       screen scraping Test::More and the failure output changed.  By
       distributing them together we ensure TBT won't break again.
     * Test::Builder->BAILOUT() was missing.

==== //depot/perl/lib/Test/Simple/t/fail-more.t#12 (text) ====
Index: perl/lib/Test/Simple/t/fail-more.t
--- perl/lib/Test/Simple/t/fail-more.t#11~25604~        2005-09-26 
09:31:43.000000000 -0700
+++ perl/lib/Test/Simple/t/fail-more.t  2006-07-09 06:51:37.000000000 -0700
@@ -45,7 +45,7 @@
 package main;
 
 require Test::More;
-my $Total = 28;
+my $Total = 29;
 Test::More->import(tests => $Total);
 
 my $tb = Test::More->builder;
@@ -141,6 +141,7 @@
 #line 52
 can_ok('Mooble::Hooble::Yooble', qw(this that));
 can_ok('Mooble::Hooble::Yooble', ());
+can_ok(undef, undef);
 err_ok( <<ERR );
 #   Failed test 'Mooble::Hooble::Yooble->can(...)'
 #   in $0 at line 52.
@@ -149,6 +150,9 @@
 #   Failed test 'Mooble::Hooble::Yooble->can(...)'
 #   in $0 at line 53.
 #     can_ok() called with no methods
+#   Failed test '->can(...)'
+#   in $0 at line 54.
+#     can_ok() called with empty class or reference
 ERR
 
 #line 55
@@ -288,6 +292,7 @@
 not ok - fail()
 not ok - Mooble::Hooble::Yooble->can(...)
 not ok - Mooble::Hooble::Yooble->can(...)
+not ok - ->can(...)
 not ok - The object isa Wibble
 not ok - My Wibble isa Wibble
 not ok - Another Wibble isa Wibble

==== //depot/perl/lib/Test/Simple/t/tbt_01basic.t#4 (text) ====
Index: perl/lib/Test/Simple/t/tbt_01basic.t
--- perl/lib/Test/Simple/t/tbt_01basic.t#3~25723~       2005-10-09 
11:53:02.000000000 -0700
+++ perl/lib/Test/Simple/t/tbt_01basic.t        2006-07-09 06:51:37.000000000 
-0700
@@ -7,7 +7,7 @@
     }
 }
 
-use Test::Builder::Tester tests => 9;
+use Test::Builder::Tester tests => 12;
 use Test::More;
 
 ok(1,"This is a basic test");

==== //depot/perl/lib/Test/Simple/t/tbt_05faildiag.t#3 (text) ====
Index: perl/lib/Test/Simple/t/tbt_05faildiag.t
--- perl/lib/Test/Simple/t/tbt_05faildiag.t#2~25719~    2005-10-09 
08:32:29.000000000 -0700
+++ perl/lib/Test/Simple/t/tbt_05faildiag.t     2006-07-09 06:51:37.000000000 
-0700
@@ -12,26 +12,23 @@
 
 # test_fail
 
-test_out("not ok 1 - one");
-test_fail(+1);
+test_fail(+1, 'one');
 ok(0,"one");
 
-test_out("not ok 2 - two");
-test_fail(+2);
+test_fail(+2, 'two');
 
 ok(0,"two");
 
 test_test("test fail");
 
-test_fail(+2);
-test_out("not ok 1 - one");
+test_fail(+1, 'one');
 ok(0,"one");
 test_test("test_fail first");
 
 # test_diag
 
 use Test::Builder;
-my $test = new Test::Builder;
+my $test = Test::Builder->new();
 
 test_diag("this is a test string","so is this");
 $test->diag("this is a test string\n", "so is this\n");
@@ -47,5 +44,3 @@
 $test->diag("this is a test string\n");
 $test->diag("so is this\n");
 test_test("test diag multiple");
-
-
End of Patch.

Reply via email to