diff options
author | Colin Kuskie <colink@perldreamer.com> | 2012-10-02 17:13:02 -0700 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2013-07-29 16:08:59 +1000 |
commit | 748cc03cd5ccfe4fb015da434bcb7dfb6125253b (patch) | |
tree | 60ec2068aa577ae99e4d2b15b5d8f9bf812025bd /ext/Pod-Functions | |
parent | ea61db2856f3706b0b3684e779a2b8c6a76230b9 (diff) | |
download | perl-748cc03cd5ccfe4fb015da434bcb7dfb6125253b.tar.gz |
Refactor ext/Pod-Functions/Functions_pm.PL to use Test::More instead of making TAP by hand.
Diffstat (limited to 'ext/Pod-Functions')
-rw-r--r-- | ext/Pod-Functions/Functions_pm.PL | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/ext/Pod-Functions/Functions_pm.PL b/ext/Pod-Functions/Functions_pm.PL index 7cf0b51e92..578ec8996b 100644 --- a/ext/Pod-Functions/Functions_pm.PL +++ b/ext/Pod-Functions/Functions_pm.PL @@ -4,7 +4,13 @@ use Pod::Simple::SimpleTree; my ($tap, $test, %Missing); -@ARGV = grep { not($_ eq '--tap' and $tap = 1) } @ARGV; +BEGIN { + @ARGV = grep { not($_ eq '--tap' and $tap = 1) } @ARGV; + if ($tap) { + require Test::More; + Test::More->import; + } +} my (%Kinds, %Flavor, @Types); my %Omit; @@ -95,34 +101,26 @@ 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"; + ok ( $Type{$func}, "$func is mentioned in at least one category group"); } 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"; + fail( "function '$_' has no summary for Pod::Functions" ); } else { - print "not ok $test - section '$_' has no type for Pod::Functions\n"; + fail( "for Pod::Functions" ); } } foreach my $kind (sort keys %Kinds) { my $funcs = $Kinds{$kind}; ++$test; my $want = join ' ', sort_funcs(@$funcs); - if ("@$funcs" eq $want) { - print "ok $test - category $kind is correctly sorted\n"; - } else { - print "not ok $test - category $kind is correctly sorted\n"; - print STDERR "# Have @$funcs\n# Want $want\n"; - } + is ("@$funcs", $want, "category $kind is correctly sorted" ); } - print "1..$test\n"; + done_testing(); exit; } @@ -198,7 +196,7 @@ L<perlfunc/"Perl Functions by Category"> section. =cut -our $VERSION = '1.07'; +our $VERSION = '1.08'; require Exporter; |