X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Fi386%2Flibmodule-build-perl%2Flibmodule-build-perl-0.2808.01%2Ft%2Fpod_parser.t;fp=dev%2Fi386%2Flibmodule-build-perl%2Flibmodule-build-perl-0.2808.01%2Ft%2Fpod_parser.t;h=cd5fd2284b9f6d96eb56b259029a69e2f990ee38;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hp=0000000000000000000000000000000000000000;hpb=df794b845212301ea0d267c919232538bfef356a;p=dh-make-perl diff --git a/dev/i386/libmodule-build-perl/libmodule-build-perl-0.2808.01/t/pod_parser.t b/dev/i386/libmodule-build-perl/libmodule-build-perl-0.2808.01/t/pod_parser.t new file mode 100644 index 0000000..cd5fd22 --- /dev/null +++ b/dev/i386/libmodule-build-perl/libmodule-build-perl-0.2808.01/t/pod_parser.t @@ -0,0 +1,70 @@ +#!/usr/bin/perl -w + +use strict; +use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; +use MBTest tests => 7; + +use Cwd (); +my $cwd = Cwd::cwd; + +######################### + +use_ok 'Module::Build::PodParser'; + +{ + package IO::StringBased; + + sub TIEHANDLE { + my ($class, $string) = @_; + return bless { + data => [ map "$_\n", split /\n/, $string], + }, $class; + } + + sub READLINE { + shift @{ shift()->{data} }; + } +} + +local *FH; +tie *FH, 'IO::StringBased', <<'EOF'; +=head1 NAME + +Foo::Bar - Perl extension for blah blah blah + +=head1 AUTHOR + +C was written by Engelbert Humperdinck Ieh@example.comE> in 2004. + +Home page: http://example.com/~eh/ + +=cut +EOF + + +my $pp = Module::Build::PodParser->new(fh => \*FH); +ok $pp, 'object created'; + +is $pp->get_author->[0], 'C was written by Engelbert Humperdinck Ieh@example.comE> in 2004.', 'author'; +is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract'; + + +{ + # Try again without a valid author spec + untie *FH; + tie *FH, 'IO::StringBased', <<'EOF'; +=head1 NAME + +Foo::Bar - Perl extension for blah blah blah + +=cut +EOF + + my $pp = Module::Build::PodParser->new(fh => \*FH); + ok $pp, 'object created'; + + is_deeply $pp->get_author, [], 'author'; + is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract'; +} + +