Ian Langworth wrote: > On 30.Nov.2004 09:57AM -0600, Andy Lester wrote: > > >> plan tests => 14, have( "Foo::Wango" ), moon_phase eq "waning", etc; > > > Where does the reason fit into this syntax?
well, this syntax doesn't exist in Test::More at the moment (though I probably should get around to a patch like I promised) - it's only in Apache-Test. the A-T syntax can be found in the Apache::Test manpage, but basically it comes down to plan() accepting a third optional argument, which is a boolean saying whether or not you want to skip the entire file. but to answer your question, have() is an internal function that essentially interacts with TAP to yield something like "all skipped: Foo::Wango not found". the reason that have() operates this way is because we can say plan tests => 14, have(qw(Foo::Wango Bar::Beer Java::Cool)); and it will show up as a single "all skipped: Foo::Wango not found, Java::Cool not found". we also provide skip_message() as an interface into the same, so you can write your own functions and layer them on top of plan(), like so plan tests => 14, have have_min_perl_version(5.6), have_lwp, have_module('Foo::Wango'), sub { $< or skip_message('running as root!') }; here, the skip message would include all the conditions that failed, not just the first one. the idea being that you would know all the test preconditions that need to be met after the first run, and not need to figure them out one at a time until the test can actually run. oh, and for the record, it's now need() (and need* variants, like need_module()) in A-T, not have() and have* variants. the difference being that need* functions deal with the skip message while have* functions do not, so they can safely be used to determine logical pathways within the tests themselves. see the A-T docs for more. nevertheless, what you are replying to was just a discussion about a feature that doesn't exist in the standard Test::More toolkit but was brought up because Apache-Test's plan() works a bit differently and there are enough people who like it that I thought it warranted a discussion here to see if T::M was interested. HTH --Geoff