|
From: Eric S. <sau...@as...> - 2008-03-03 12:56:27
|
> As we're free to use Test::More now (5.005's gone :-), the best way
> probably is:
>
> ... in .t script:
>
> use Test::More;
> eval "require Net::Jabber" or plan "skip_all";
> plan tests => 42;
>
If it's just one or two tests that fail due to explicit dependencies, then
you might consider skipping them explicitly in a named block, rather than
bypassing the whole .t. From the Test::More manpage:
SKIP: {
eval { require HTML::Lint };
skip "HTML::Lint not installed", 2 if $@;
my $lint = new HTML::Lint;
isa_ok( $lint, "HTML::Lint" );
$lint->parse( $html );
is( $lint->errors, 0, "No errors found in HTML" );
}
If the user does not have HTML::Lint installed, the whole block
of code won't be run at all. Test::More will output special
ok's which Test::Harness interprets as skipped, but passing,
tests.
Cheers
Eric
|