File: head.t

package info (click to toggle)
libpod-pom-perl 0.02-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 192 kB
  • ctags: 117
  • sloc: perl: 1,277; makefile: 50
file content (66 lines) | stat: -rw-r--r-- 1,300 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w                                         # -*- perl -*-

use strict;
use lib qw( ./lib ../lib );
use Pod::POM::Test;

#$Pod::POM::DEBUG = 1;
#$Pod::POM::Node::DEBUG = 1;
my $DEBUG = 1;

ntests(11);

package My::View;
use base qw( Pod::POM::View );

sub view_seq_entity {
    my ($self, $text) = @_;
    return "ENTITY: [$text]";
}

package main;

my $parser = Pod::POM->new();
my $pom = $parser->parse_file(\*DATA);
assert( $pom );

my $sections = $pom->head1();
match( scalar @$sections, 2 );
match( $sections->[0]->title(), 'NAME' );
match( $sections->[1]->title(), 'DESCRIPTION' );
match( $sections->[0]->type(), 'head1' );

my $items = $pom->head1->[1]->head2->[0]->over->[0]->item;
my $view = My::View->new();
match( $items->[0]->title, 'new() =E<gt> $object' );
match( $view->print($items->[0]->title), 'new() =ENTITY: [gt] $object' );

match( $view->print($sections->[0]->title()), 'NAME' );
match( $view->print($sections->[1]->title()), 'DESCRIPTION' );

my @expect = qw( NAME DESCRIPTION );
foreach my $head1 ($pom->head1()) {
    match( $head1->title(), shift @expect );
}


__DATA__
=head1 NAME

Document Name

=head1 DESCRIPTION

This is a description.

=head2 METHODS

These are the methods:

=over 4

=item new() =E<gt> $object

This is the constructor method.

=back