| 1 |
use strict; |
| 2 |
use FindBin; |
| 3 |
|
| 4 |
our @methods; |
| 5 |
BEGIN { |
| 6 |
my $module = "$FindBin::Bin/../lib/WWW/Mechanize/Shell.pm"; |
| 7 |
open MODULE, "< $module" |
| 8 |
or die "Couldn't open module file '$module'"; |
| 9 |
@methods = map { /^\s*sub run_([a-z]+)\s*\{/ ? $1 : () } <MODULE>; |
| 10 |
close MODULE; |
| 11 |
}; |
| 12 |
|
| 13 |
use Test::More tests => scalar @methods*3 +2; |
| 14 |
|
| 15 |
# Disable all ReadLine functionality |
| 16 |
$ENV{PERL_RL} = 0; |
| 17 |
|
| 18 |
SKIP: { |
| 19 |
eval { require Pod::Constants;}; |
| 20 |
skip "Need Pod::Constants to test the documentation", 2 + scalar @methods*3 |
| 21 |
if $@; |
| 22 |
|
| 23 |
use_ok("WWW::Mechanize::Shell"); |
| 24 |
|
| 25 |
my $shell = WWW::Mechanize::Shell->new("shell", rcfile => undef, warnings => undef ); |
| 26 |
isa_ok($shell,"WWW::Mechanize::Shell"); |
| 27 |
for my $method (@methods) { |
| 28 |
my $helptext = $shell->catch_smry($method); |
| 29 |
is($@,'',"No error"); |
| 30 |
isnt( $helptext, undef, "Documentation for $method is there"); |
| 31 |
isnt( $helptext, '', "Documentation for $method is not empty"); |
| 32 |
}; |
| 33 |
}; |