The patch below allows you to supply your own test name for the isa_ok
function (I find the default insufficiently descriptive).  I'd like to do
the same for can_ok but I don't think that could be done without breaking
backwards compatibility.

-dave


--- More.t~     Wed Sep  5 19:23:24 2001
+++ More.t      Mon Sep 24 18:24:15 2001
@@ -1,4 +1,4 @@
-use Test::More tests => 22;
+use Test::More tests => 23;

 use_ok('Text::Soundex');
 require_ok('Test::More');
@@ -20,6 +20,7 @@
                                    can_ok pass fail eq_array eq_hash
eq_set));

 isa_ok(bless([], "Foo"), "Foo");
+isa_ok(bless([], "Foo"), "Foo", "Optional description to isa_ok");


--- More.pm~    Tue Sep 18 16:54:50 2001
+++ More.pm     Mon Sep 24 18:25:45 2001
@@ -447,7 +447,7 @@

 =item B<isa_ok>

-  isa_ok($object, $class);
+  isa_ok($object, $class, $optional_name);

 Checks to see if the given $object->isa($class).  Also checks to make
 sure the object was defined in the first place.  Handy for this sort
@@ -465,11 +465,11 @@

 =cut

-sub isa_ok ($$) {
-    my($object, $class) = @_;
+sub isa_ok ($$;$) {
+    my($object, $class, $name) = @_;

     my $diag;
-    my $name = "object->isa('$class')";
+    $name ||= "object->isa('$class')";
     if( !defined $object ) {
         $diag = "The object isn't defined";
     }


Reply via email to