Subject: | [PATCH] test description says file has no pod |
Date: | Sun, 13 Apr 2008 14:22:29 -0300 |
To: | bug-Test-Pod [...] rt.cpan.org, "Andy Lester" <andy [...] petdance.com> |
From: | "Adriano Ferreira" <a.r.ferreira [...] gmail.com> |
Hi, Andy.
The attached patch adds a few minor changes to Test-Pod dist. The most
important of them is to detect when a tested file has no POD (which
tests ok as it should) and to include that in the test decription.
So a file "Foo.pm" which has correct POD will continue to emit
pod_file_ok( "Foo.pm" );
a TAP line
ok ? POD test for Foo.pm
and for a file "foo.t" with no POD whatsoever, it will say
ok ? POD test for foo.t (no pod)
That corresponds to that piece of the patch:
@@ -115,6 +115,7 @@
$checker->parse_file( $file );
my $ok = !$checker->any_errata_seen;
+ $name .= ' (no pod)' if !$checker->content_seen;
$Test->ok( $ok, $name );
###
Another issue was that at "all_pod_files_ok", the generated test
description illustrated above was overriden by only the file name. The
fix for this (if desirable) would be only:
@@ -156,7 +157,7 @@
my $ok = 1;
foreach my $file ( @files ) {
- pod_file_ok( $file, $file ) or undef $ok;
+ pod_file_ok( $file ) or undef $ok;
}
return $ok;
###
Also in the docs, the first definition of what Test::Pod understand by
POD files (in all_pod_files_ok() description) does not match the one
at all_pod_files().
The patch piece below reconciliate this:
@@ -135,7 +136,7 @@
If C<@files> is empty or not passed, the function finds all POD files in
the F<blib> directory if it exists, or the F<lib> directory if not.
-A POD file is one that ends with F<.pod>, F<.pl> and F<.pm>, or any file
+A POD file is one that ends with F<.pod>, F<.pl>, F<.pm>, F<.PL> and
F<.t>, or any file
where the first line looks like a shebang line.
If you're testing a module, just make a F<t/pod.t>:
###
And, at last, the MANIFEST had two entries for "t/pod/good-pod-script"
and the patch cuts that.
@@ -15,7 +15,6 @@
t/missing-file.t
t/pod.t
t/pod/good-pod-script
-t/pod/good-pod-script
t/pod/good.pod
t/pod/no_pod.pod
t/selftest.t
###
Best,
Adriano Ferreira
Message body is not shown because sender requested not to inline it.