blob: 03d87f80d6cd1b60592534a55fe99765b346012f (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# -*- perl -*-
use strict;
use Pod::Html::Util qw( anchorify );
use Test::More tests => 1;
my @filedata;
{
local $/ = '';
@filedata = <DATA>;
}
my (@poddata, $i, $j);
for ($i = 0, $j = -1; $i <= $#filedata; $i++) {
$j++ if ($filedata[$i] =~ /^\s*=head[1-6]/);
if ($j >= 0) {
$poddata[$j] = "" unless defined $poddata[$j];
$poddata[$j] .= "\n$filedata[$i]" if $j >= 0;
}
}
my %heads = ();
foreach $i (0..$#poddata) {
$heads{anchorify($1)} = 1 if $poddata[$i] =~ /=head[1-6]\s+(.*)/;
}
my %expected = map { $_ => 1 } qw(
NAME
DESCRIPTION
Subroutine
Error
Method
Has_A_Wordspace
HasTrailingWordspace
HasLeadingWordspace
Has_Extra_InternalWordspace
Has_Quotes
Has_QuestionMark
Has_Hyphen_And_Space
);
is_deeply(
\%heads,
\%expected,
"Got expected POD heads"
);
__DATA__
=head1 NAME
anchorify - Test C<Pod::Html::Util::anchorify()>
=head1 DESCRIPTION
alpha
=head2 Subroutine
beta
=head3 Error
gamma
=head4 Method
delta
=head4 Has A Wordspace
delta
=head4 HasTrailingWordspace
epsilon
=head4 HasLeadingWordspace
zeta
=head4 Has Extra InternalWordspace
eta
=head4 Has"Quotes"
theta
=head4 Has?QuestionMark
iota
=head4 Has-Hyphen And Space
kappa
=cut
__END__
|