contains_pod.t revision 1.1
1use strict; 2use warnings; 3use Test::More tests => 3; 4use Module::Metadata; 5 6*fh_from_string = $] < 5.008 7 ? require IO::Scalar && sub ($) { 8 IO::Scalar->new(\$_[0]); 9 } 10 : sub ($) { 11 open my $fh, '<', \$_[0]; 12 $fh 13 } 14; 15 16{ 17 my $src = <<'...'; 18package Foo; 191; 20... 21 22 my $fh = fh_from_string($src); 23 my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); 24 ok(!$module->contains_pod(), 'This module does not contains POD'); 25} 26 27{ 28 my $src = <<'...'; 29package Foo; 301; 31 32=head1 NAME 33 34Foo - bar 35... 36 37 my $fh = fh_from_string($src); 38 my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); 39 ok($module->contains_pod(), 'This module contains POD'); 40} 41 42{ 43 my $src = <<'...'; 44package Foo; 451; 46 47=head1 NAME 48 49Foo - bar 50 51=head1 AUTHORS 52 53Tokuhiro Matsuno 54... 55 56 my $fh = fh_from_string($src); 57 my $module = Module::Metadata->new_from_handle($fh, 'Foo.pm'); 58 ok($module->contains_pod(), 'This module contains POD'); 59} 60