I thought some of you might find this of interest and then I realized
that a Test::Cookbook might be useful.  Here's a problem I recently
faced and how I solved it:

Problem:

POD is incomplete in a module but you still want to test POD coverage
with something like Test::Pod::Coverage::all_pod_coverage_ok().

Solution:

Have a hash of modules to skip and use TPC's all_modules() function to
ensure you don't miss new modules.

  use strict;
  use Test::More;
  eval "use Test::Pod::Coverage 0.08";
  plan skip_all => "Test::Pod::Coverage required for testing POD
coverage" if $@;

  my %TODO = map { $_ => 1 } @modules_with_incomplete_pod;

  my @modules = Test::Pod::Coverage::all_modules();
  plan tests => scalar @modules;
  foreach my $module (@modules) {
    if (exists $TODO{$module}) {
      TODO: {
        local $TODO = "Known incomplete POD for $module";
        pod_coverage_ok($module);
      };
    }
    else {
      pod_coverage_ok($module);
    }
  }

Discussion.

Actually, I'd rather have a Test::Cookbook discussion.  You can see the
intent of the above code.  It's not perfect (and I'm open to
suggestions for improvement), but it's something that is not
immediately obvious to someone who just started testing.

Cheers,
Ovid

=====
Silence is Evil            
http://users.easystreet.com/ovid/philosophy/decency.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

Reply via email to