Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by mauzo (8185) on 2008.11.03 13:23 (#65705)
    something like


    use strict;
    use warnings;

    use Test::More;

    my $tests;

    BEGIN { $tests += 3 }
    use_ok 'Clone::Closure';
    can_ok 'Clone::Closure', 'clone';
    ok !main->can('clone'), 'clone not exported by default';

    BEGIN { $tests += 2 }
    use_ok 'Clone::Closure', 'clone';
    can_ok 'main', 'clone';

    BEGIN { plan tests => $tests }

    BAIL_OUT('module will not load')
        if grep !$_, Test::More->builder->summary;

    as t/00use.t and then just use the modules after that. I'm deliberately ignoring the fact the use_ok ought to called at BEGIN time, as I'm not actually using any of the module's functionality in this test program.

    • This is similar to my approach, though I don't usually test for specific functions or methods. Once I've established that the modules can load, I leave it to individual suites to test specific modules.

      (But then, I also arrange my suites so that no suite is dependent on a module that hasn't already been vetted by a previous suite. I'm just anal-retentive that way...)