Remove unused Module::Build tests
[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';
5use MBTest tests => 7;
6
7use Cwd ();
8my $cwd = Cwd::cwd;
9
10#########################
11
12use_ok 'Module::Build::PodParser';
13
14{
15 package IO::StringBased;
16
17 sub TIEHANDLE {
18 my ($class, $string) = @_;
19 return bless {
20 data => [ map "$_\n", split /\n/, $string],
21 }, $class;
22 }
23
24 sub READLINE {
25 shift @{ shift()->{data} };
26 }
27}
28
29local *FH;
30tie *FH, 'IO::StringBased', <<'EOF';
31=head1 NAME
32
33Foo::Bar - Perl extension for blah blah blah
34
35=head1 AUTHOR
36
37C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.
38
39Home page: http://example.com/~eh/
40
41=cut
42EOF
43
44
45my $pp = Module::Build::PodParser->new(fh => \*FH);
46ok $pp, 'object created';
47
48is $pp->get_author->[0], 'C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.', 'author';
49is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
50
51
52{
53 # Try again without a valid author spec
54 untie *FH;
55 tie *FH, 'IO::StringBased', <<'EOF';
56=head1 NAME
57
58Foo::Bar - Perl extension for blah blah blah
59
60=cut
61EOF
62
63 my $pp = Module::Build::PodParser->new(fh => \*FH);
64 ok $pp, 'object created';
65
66 is_deeply $pp->get_author, [], 'author';
67 is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
68}
69
70