On Sun, 24 Jun 2001, brian moseley wrote:

>
> fwiw, i've come up with a couple of other useful shorthand
> routines for my Wombat::Test package:
>
>   sub have_lib {
>       for (@_) {
>           unless (eval "require $_") {
>               $@ = "$_ not found\n" if $@ =~ /^Can't locate/;
>               return undef;
>           }
>       }
>       return 1;
>   }

sometimes it's not 1:1 : e.g. see: Apache::TestRequest::have_lwp

but certainly this one looks a good candidate to go inside as it makes the
test framework API more generic. I'll let Doug to judge though.

>   sub skip_all {
>       my $msg = $_[0] ? " # Skipped: $_[0]" : '';
>       print "1..0$msg\n";
>       exit;
>   }

already there more or less. See perldoc Apache::Test in cvs.

> they allow me to do stuff like this at the beginning of each
> test file:
>
>   skip_all $@ unless have_lib qw(mod_perl Foo Apache::FakeRequest);
>   plan tests => 6;
>
> which gives this output:
>
>   connector/apache/apache.skipped: Foo not found

yes, but it reports only one missing module even if two are missing :)
better to report all the missing pieces at once. but it should be in one
string or Test::Harness will say: 'for various reasons' :)



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to