summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-12-27 19:00:44 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-12-27 19:00:44 -0800
commit7a160a887342dbe0525b9a33c1a772ecf614edb8 (patch)
tree1ad6ed7be84d7167b90bb780e22b3448ff424fda /t
downloadperl-Test-Pod-Coverage-7a160a887342dbe0525b9a33c1a772ecf614edb8.tar.gz
perl-Test-Pod-Coverage-7a160a887342dbe0525b9a33c1a772ecf614edb8.tar.bz2
perl-Test-Pod-Coverage-7a160a887342dbe0525b9a33c1a772ecf614edb8.zip
Imported Upstream version 1.08upstream/1.08
Diffstat (limited to 't')
-rw-r--r--t/00.load.t7
-rw-r--r--t/Nopod.pm9
-rw-r--r--t/Nosymbols.pm13
-rw-r--r--t/PC_Inherited.pm15
-rw-r--r--t/PC_Inherits.pm13
-rw-r--r--t/Privates.pm33
-rw-r--r--t/Simple.pm31
-rw-r--r--t/all_modules.t18
-rw-r--r--t/all_pod_coverage_ok.t6
-rw-r--r--t/alt_class.t21
-rw-r--r--t/nopod.t16
-rw-r--r--t/nosymbols.t24
-rw-r--r--t/parms.t16
-rw-r--r--t/pod.t6
-rw-r--r--t/privates.t37
-rw-r--r--t/self.t7
-rw-r--r--t/simple.t21
17 files changed, 293 insertions, 0 deletions
diff --git a/t/00.load.t b/t/00.load.t
new file mode 100644
index 0000000..37beeb6
--- /dev/null
+++ b/t/00.load.t
@@ -0,0 +1,7 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+use_ok( 'Test::Pod::Coverage' );
+
+diag( "Testing Test::Pod::Coverage $Test::Pod::Coverage::VERSION" );
diff --git a/t/Nopod.pm b/t/Nopod.pm
new file mode 100644
index 0000000..e8700ab
--- /dev/null
+++ b/t/Nopod.pm
@@ -0,0 +1,9 @@
+package Nopod;
+
+# Documentation is for wimps!
+#
+sub foo {}
+sub bar {}
+sub baz {}
+
+1;
diff --git a/t/Nosymbols.pm b/t/Nosymbols.pm
new file mode 100644
index 0000000..8db35cc
--- /dev/null
+++ b/t/Nosymbols.pm
@@ -0,0 +1,13 @@
+package Nosymbols;
+
+=head1 NAME
+
+This is a dummy module with all POD, no symbols.
+
+=head1 DESCRIPTION
+
+This is a pod file without errors.
+
+=cut
+
+1;
diff --git a/t/PC_Inherited.pm b/t/PC_Inherited.pm
new file mode 100644
index 0000000..26e545b
--- /dev/null
+++ b/t/PC_Inherited.pm
@@ -0,0 +1,15 @@
+package PC_Inherited;
+
+=head1 NAME
+
+PC_Inherited - we write docs so you don't have to!
+
+=head2 C< new >
+
+ ...
+
+=cut
+
+sub new { }
+
+1;
diff --git a/t/PC_Inherits.pm b/t/PC_Inherits.pm
new file mode 100644
index 0000000..fa3f108
--- /dev/null
+++ b/t/PC_Inherits.pm
@@ -0,0 +1,13 @@
+package PC_Inherits;
+use base qw(PC_Inherited);
+
+=head1 NAME
+
+PC_Inherit - inherits and doesn't document parent things!
+
+=cut
+
+# documented in parent; stupid to document here, too!
+sub new { }
+
+1;
diff --git a/t/Privates.pm b/t/Privates.pm
new file mode 100644
index 0000000..e690563
--- /dev/null
+++ b/t/Privates.pm
@@ -0,0 +1,33 @@
+package Privates;
+
+sub foo {}
+sub bar {}
+sub baz {}
+sub INTERNAL_THING {}
+sub INTERNAL_DOODAD {}
+
+1;
+__END__
+
+# test module - three subs, one without, one with an item, one with a head2
+
+=head2 Methods
+
+=over
+
+=item foo
+
+this is foo
+
+=back
+
+=head2 bar
+
+The bar is just a throwaway.
+
+=head2 baz
+
+baz is very important
+
+=cut
+
diff --git a/t/Simple.pm b/t/Simple.pm
new file mode 100644
index 0000000..6d6b6c6
--- /dev/null
+++ b/t/Simple.pm
@@ -0,0 +1,31 @@
+package Simple;
+
+sub foo {}
+sub bar {}
+sub baz {}
+
+1;
+__END__
+
+# test module - three subs, one without, one with an item, one with a head2
+
+=head2 Methods
+
+=over
+
+=item foo
+
+this is foo
+
+=back
+
+=head2 bar
+
+The bar is just a throwaway.
+
+=head2 baz
+
+baz is very important
+
+=cut
+
diff --git a/t/all_modules.t b/t/all_modules.t
new file mode 100644
index 0000000..ae3432b
--- /dev/null
+++ b/t/all_modules.t
@@ -0,0 +1,18 @@
+#!perl -T
+
+use strict;
+
+use Test::More tests => 2;
+
+BEGIN {
+ use_ok( "Test::Pod::Coverage" );
+}
+
+my @files = Test::Pod::Coverage::all_modules( "blib" );
+
+# The expected files have slashes, not File::Spec separators, because
+# that's how File::Find does it.
+my @expected = qw( Test::Pod::Coverage );
+@files = sort @files;
+@expected = sort @expected;
+is_deeply( \@files, \@expected, "Got all the distro files" );
diff --git a/t/all_pod_coverage_ok.t b/t/all_pod_coverage_ok.t
new file mode 100644
index 0000000..9c3d88c
--- /dev/null
+++ b/t/all_pod_coverage_ok.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+# This is the most basic form that most people will use.
+
+use Test::Pod::Coverage;
+all_pod_coverage_ok();
diff --git a/t/alt_class.t b/t/alt_class.t
new file mode 100644
index 0000000..83801b0
--- /dev/null
+++ b/t/alt_class.t
@@ -0,0 +1,21 @@
+#!perl -T
+
+use strict;
+use lib "t";
+use Test::More tests=>2;
+use Test::Builder::Tester;
+
+BEGIN { use_ok( 'Test::Pod::Coverage' ); }
+
+# the follow test checks that PC_Inherits.pm is fully covered, which it is not
+# -- unless you count the documentation of its parent, PC_Inherited; we do this
+# with the Pod::Coverage::CountParents subclass of Pod::Coverage -- so, if this
+# test passes, it means the subclass was, in fact, used
+test_out( "ok 1 - Checking PC_Inherits" );
+pod_coverage_ok(
+ "PC_Inherits",
+ { coverage_class => 'Pod::Coverage::CountParents' },
+ "Checking PC_Inherits",
+);
+
+test_test( "allows alternate Pod::Coverage class" );
diff --git a/t/nopod.t b/t/nopod.t
new file mode 100644
index 0000000..d5bebe8
--- /dev/null
+++ b/t/nopod.t
@@ -0,0 +1,16 @@
+#!perl -T
+
+use strict;
+use lib "t";
+use Test::More tests=>2;
+use Test::Builder::Tester;
+
+BEGIN {
+ use_ok( 'Test::Pod::Coverage' );
+}
+
+test_out( "not ok 1 - Checking Nopod" );
+test_fail(+2);
+test_diag( "Nopod: couldn't find pod" );
+pod_coverage_ok( "Nopod", "Checking Nopod" );
+test_test( "Handles files with no pod at all" );
diff --git a/t/nosymbols.t b/t/nosymbols.t
new file mode 100644
index 0000000..02d2c41
--- /dev/null
+++ b/t/nosymbols.t
@@ -0,0 +1,24 @@
+#!perl -T
+
+use strict;
+use lib "t";
+use Test::More tests => 3;
+use Test::Builder::Tester;
+
+BEGIN {
+ use_ok( 'Test::Pod::Coverage' );
+}
+
+NO_VERBOSE: {
+ test_out( "ok 1 - Checking Nosymbols" );
+ pod_coverage_ok( "Nosymbols", "Checking Nosymbols" );
+ test_test( "Handles files with no symbols" );
+}
+
+VERBOSE: {
+ local $ENV{HARNESS_VERBOSE} = 1;
+ test_out( "ok 1 - Checking Nosymbols" );
+ test_diag( "Nosymbols: no public symbols defined" );
+ pod_coverage_ok( "Nosymbols", "Checking Nosymbols" );
+ test_test( "Handles files with no symbols" );
+}
diff --git a/t/parms.t b/t/parms.t
new file mode 100644
index 0000000..5076516
--- /dev/null
+++ b/t/parms.t
@@ -0,0 +1,16 @@
+#!perl -T
+
+use lib "t";
+use strict;
+use Test::More tests=>2;
+use Test::Builder::Tester;
+
+BEGIN {
+ use_ok( 'Test::Pod::Coverage' );
+}
+
+OPTIONAL_MESSAGE: {
+ test_out( "ok 1 - Pod coverage on Simple" );
+ pod_coverage_ok( "Simple" );
+ test_test( "Simple runs under T:B:T" );
+}
diff --git a/t/pod.t b/t/pod.t
new file mode 100644
index 0000000..976d7cd
--- /dev/null
+++ b/t/pod.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
diff --git a/t/privates.t b/t/privates.t
new file mode 100644
index 0000000..d8fa2cc
--- /dev/null
+++ b/t/privates.t
@@ -0,0 +1,37 @@
+#!perl -T
+
+use strict;
+use lib "t";
+use Test::More tests=>4;
+use Test::Builder::Tester;
+
+BEGIN {
+ use_ok( 'Test::Pod::Coverage' );
+}
+
+MISSING_FUNCS: {
+ test_out( "not ok 1 - Privates fails" );
+ test_fail(+4);
+ test_diag( "Coverage for Privates is 60.0%, with 2 naked subroutines:" );
+ test_diag( "\tINTERNAL_DOODAD" );
+ test_diag( "\tINTERNAL_THING" );
+ pod_coverage_ok( "Privates", "Privates fails" );
+ test_test( "Should fail at 60%" );
+}
+
+SPECIFIED_PRIVATES: {
+ test_out( "ok 1 - Privates works w/a custom PC object" );
+ pod_coverage_ok(
+ "Privates",
+ { also_private => [ qr/^[A-Z_]+$/ ], },
+ "Privates works w/a custom PC object"
+ );
+ test_test( "Trying to pass PC object" );
+}
+
+SPECIFIED_PRIVATES_NAKED: {
+ pod_coverage_ok(
+ "Privates",
+ { also_private => [ qr/^[A-Z_]+$/ ], },
+ );
+}
diff --git a/t/self.t b/t/self.t
new file mode 100644
index 0000000..1d09722
--- /dev/null
+++ b/t/self.t
@@ -0,0 +1,7 @@
+#!perl -T
+
+use lib "t";
+use strict;
+use Test::Pod::Coverage tests=>1;
+
+pod_coverage_ok( "Test::Pod::Coverage", "T:P:C itself is OK" );
diff --git a/t/simple.t b/t/simple.t
new file mode 100644
index 0000000..ed01aed
--- /dev/null
+++ b/t/simple.t
@@ -0,0 +1,21 @@
+#!perl -T
+
+use lib "t";
+use strict;
+use Test::More tests=>4;
+use Test::Builder::Tester;
+
+BEGIN {
+ use_ok( 'Test::Pod::Coverage' );
+}
+
+pod_coverage_ok( "Simple", "Simple is OK" );
+
+# Now try it under T:B:T
+test_out( "ok 1 - Simple is still OK" );
+pod_coverage_ok( "Simple", "Simple is still OK" );
+test_test( "Simple runs under T:B:T" );
+
+test_out( "ok 1 - Pod coverage on Simple" );
+pod_coverage_ok( "Simple" );
+test_test( "Simple runs under T:B:T" );