diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-01-30 18:41:54 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-02-18 13:16:52 +0100 |
commit | 7fa6cc82dc87eb2f81137861238570e42953b675 (patch) | |
tree | 0d0a6327fc394ed5408eb858a44ba6bb471f96b9 | |
parent | 4094982d4b552a75a521bdc7df40396d0b57ae4f (diff) | |
download | perl-7fa6cc82dc87eb2f81137861238570e42953b675.tar.gz |
Test that every function in perlfunc.pod has a summary for Pod::Functions.
Historically Pod::Functions has failed to get updated when functions are
added. This should solve that.
-rw-r--r-- | ext/Pod-Functions/Functions_pm.PL | 21 | ||||
-rw-r--r-- | t/porting/perlfunc.t | 3 |
2 files changed, 19 insertions, 5 deletions
diff --git a/ext/Pod-Functions/Functions_pm.PL b/ext/Pod-Functions/Functions_pm.PL index 12c788f8d3..648cdfaae4 100644 --- a/ext/Pod-Functions/Functions_pm.PL +++ b/ext/Pod-Functions/Functions_pm.PL @@ -2,7 +2,7 @@ use strict; use Pod::Simple::SimpleTree; -my ($tap, $test); +my ($tap, $test, %Missing); @ARGV = grep { not($_ eq '--tap' and $tap = 1) } @ARGV; @@ -30,6 +30,7 @@ foreach my $TL_node (@$tree[2 .. $#$tree]) { if ($TL_node->[$i+1][0] ne 'for' || $TL_node->[$i+1][1]{target} ne 'Pod::Functions') { ++$i; + ++$Missing{$item_text} unless $Omit{$item_text}; next; } my $data = $TL_node->[$i+1][2]; @@ -92,9 +93,21 @@ sub sort_funcs { if ($tap) { foreach my $func (sort_funcs(keys %Flavor)) { - ++$test; - my $ok = $Type{$func} ? 'ok' : 'not ok'; - print "$ok $test - $func is mentioned in at least one category group\n"; + ++$test; + my $ok = $Type{$func} ? 'ok' : 'not ok'; + print "$ok $test - $func is mentioned in at least one category group\n"; + } + foreach (sort keys %Missing) { + # Ignore anything that looks like an alternative for a function we've + # already seen; + s!(?: [A-Z].*| \(\)|\( LIST \)| /PATTERN/.*)!!; + next if $Flavor{$_}; + ++$test; + if (/^[_a-z]/) { + print "not ok $test - function '$_' has no summary for Pod::Functions\n"; + } else { + print "not ok $test - section '$_' has no type for Pod::Functions\n"; + } } print "1..$test\n"; exit; diff --git a/t/porting/perlfunc.t b/t/porting/perlfunc.t index b32e88acdd..fb0209db18 100644 --- a/t/porting/perlfunc.t +++ b/t/porting/perlfunc.t @@ -18,7 +18,8 @@ # It's broken - how do I fix it? # Likely it's because you changed something in pod/perlfunc.pod # If you added a new function, it needs to be added to one or more groups in -# "Perl Functions by Category". +# "Perl Functions by Category", and to have a one line summary for +# Pod::Functions provided by a =for directive. BEGIN { @INC = '..' if -f '../TestInit.pm'; |