Add ExtUtils::Miniperl to the list of core modules for all versions >= 5.00504
[p5sagit/p5-mst-13.2.git] / lib / Module / Build / t / pod_parser.t
CommitLineData
bb4e9162 1#!/usr/bin/perl -w
2
3use strict;
4use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
738349a8 5use MBTest tests => 8;
bb4e9162 6
738349a8 7use_ok 'Module::Build::PodParser';
8ensure_blib('Module::Build::PodParser');
bb4e9162 9
10#########################
11
bb4e9162 12{
13 package IO::StringBased;
14
15 sub TIEHANDLE {
16 my ($class, $string) = @_;
17 return bless {
18 data => [ map "$_\n", split /\n/, $string],
19 }, $class;
20 }
21
22 sub READLINE {
23 shift @{ shift()->{data} };
24 }
25}
26
27local *FH;
28tie *FH, 'IO::StringBased', <<'EOF';
29=head1 NAME
30
31Foo::Bar - Perl extension for blah blah blah
32
33=head1 AUTHOR
34
35C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.
36
37Home page: http://example.com/~eh/
38
39=cut
40EOF
41
42
43my $pp = Module::Build::PodParser->new(fh => \*FH);
44ok $pp, 'object created';
45
46is $pp->get_author->[0], 'C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.', 'author';
47is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
48
49
50{
51 # Try again without a valid author spec
52 untie *FH;
53 tie *FH, 'IO::StringBased', <<'EOF';
54=head1 NAME
55
56Foo::Bar - Perl extension for blah blah blah
57
58=cut
59EOF
60
61 my $pp = Module::Build::PodParser->new(fh => \*FH);
62 ok $pp, 'object created';
63
64 is_deeply $pp->get_author, [], 'author';
65 is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
66}
67
68