move xt tests to xt/author for Module::Install to work
[gitmo/MooseX-Singleton.git] / xt / author / pod-coverage.t
diff --git a/xt/author/pod-coverage.t b/xt/author/pod-coverage.t
new file mode 100644 (file)
index 0000000..5b5d246
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+
+# This is a stripped down version of all_pod_coverage_ok which lets us
+# vary the trustme parameter per module.
+my @modules = all_modules();
+plan tests => scalar @modules;
+
+my %trustme = (
+    'MooseX::Singleton' => ['init_meta'],
+    'MooseX::Singleton::Role::Meta::Class' =>
+        [qw( clear_singleton existing_singleton )],
+    'MooseX::Singleton::Role::Meta::Instance' => ['get_singleton_instance'],
+    'MooseX::Singleton::Role::Object'         => [qw( initialize instance )],
+);
+
+for my $module ( sort @modules ) {
+    my $trustme = [];
+    if ( $trustme{$module} ) {
+        my $methods = join '|', @{ $trustme{$module} };
+        $trustme = [qr/^(?:$methods)$/];
+    }
+
+    pod_coverage_ok(
+        $module, { trustme => $trustme },
+        "Pod coverage for $module"
+    );
+}