0.17 Wed Aug 29 20:16:28 EDT 2001
* Added can_ok() and isa_ok() to Test::More
can_ok
can_ok($module, @methods);
Checks to make sure the $module can do these @methods
(works with functions, too).
can_ok('Foo', qw(this that whatever));
is almost exactly like saying:
ok( Foo->can('this') );
ok( Foo->can('that') );
ok( Foo->can('whatever') );
only without all the typing. Handy for quickly
enforcing an interface.
Each method counts as a seperate test.
isa_ok
isa_ok($object, $class);
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 of thing:
my $obj = Some::Module->new;
isa_ok( $obj, 'Some::Module' );
where you'd otherwise have to write
my $obj = Some::Module->new;
ok( defined $obj && $obj->isa('Some::Module') );
to safeguard against your test script blowing up.
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
I know you get this a lot, but you're breathtaking, like a vision of
simplicity