On Mon, Nov 09, 2009 at 02:11:23AM -0800, Ovid wrote:
> For the life of me, I can't really see any utility to use_ok() or
> require_ok(). Not only are both fragile and a source of strange
> "action at a distance" bugs, but the constructs they replace not only
> work correctly, but can be viewed as tests themselves! If either "use
> My::Module" or "require My::Module" fails, the test program exits with
> a non-zero exit status, thus meaning a failure is reported.
>
> What do people think? Should we start discouraging the use of these
> tests? Maybe even go so far as to deprecate them?
I haven't found those two function to be particularly useful. I think
Test::Functional has a (less) confusing way of handling this stuff:
BEGIN {
# test will die if this fails
pretest {
use Thing;
use Other::Thing qw(foo bar);
...
} 'core dependencies';
# test won't die but will have a failure if this fails
test {
use Third::Thing;
} 'other dependencies';
}
-- Erik