summaryrefslogtreecommitdiff
path: root/ext/Pod-Simple/t/heads.t
blob: bd04ce3ba2501ec0a5524afb468ea6c1988b0d02 (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
BEGIN {
    if($ENV{PERL_CORE}) {
        chdir 't';
        @INC = '../lib';
    }
}

use strict;
use Test;
BEGIN { plan tests => 19 };

#use Pod::Simple::Debug (6);

ok 1;

use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";
sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }


print "# Simple tests for head1 - head4...\n";
ok( Pod::Simple::XMLOutStream->_out("\n=head1 Chacha\n\n"),
    '<Document><head1>Chacha</head1></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("\n=head2 Chacha\n\n"),
    '<Document><head2>Chacha</head2></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("\n=head3 Chacha\n\n"),
    '<Document><head3>Chacha</head3></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("\n=head4 Chacha\n\n"),
    '<Document><head4>Chacha</head4></Document>'
);

print "# Testing whitespace equivalence...\n";

&ok(e "\n=head1 Chacha\n\n", "\n=head1       Chacha\n\n");
&ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha\n\n");
&ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha      \n\n");



ok( Pod::Simple::XMLOutStream->_out("=head1     Chachacha"),
    '<Document><head1>Chachacha</head1></Document>'
);


print "# Testing whitespace variance ...\n";
ok( Pod::Simple::XMLOutStream->_out("=head1     Cha cha cha   \n"),
    '<Document><head1>Cha cha cha</head1></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("=head1     Cha   cha\tcha   \n"),
    '<Document><head1>Cha cha cha</head1></Document>'
);




print "# Testing head2, head3, head4 more...\n";

ok( Pod::Simple::XMLOutStream->_out("=head2     Cha   cha\tcha   \n"),
    '<Document><head2>Cha cha cha</head2></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("=head3     Cha   cha\tcha   \n"),
    '<Document><head3>Cha cha cha</head3></Document>'
);
ok( Pod::Simple::XMLOutStream->_out("=head4     Cha   cha\tcha   \n"),
    '<Document><head4>Cha cha cha</head4></Document>'
);

print "# Testing entity expansion...\n";

ok( Pod::Simple::XMLOutStream->_out("=head4 fooE<64>bar!\n"),
    Pod::Simple::XMLOutStream->_out("\n=head4  foo\@bar!\n\n"),
);

# TODO: a mode so that DumpAsXML can ask for all contiguous string
#  sequences to be fused?
# &ok( e "=head4 fooE<64>bar!\n", "\n=head4  foo\@bar!\n\n");

print "# Testing formatting sequences...\n";

# True only if the sequences resolve, as they should...
&ok( e "=head4 C<foobar!>\n", "\n=head4 C<< foobar!    >>\n\n");
&ok( e "=head4 C<foobar!>\n", "\n\n=head4 C<<<  foobar! >>>\n");
&ok( e "=head4 C<foobar!>\n", "\n=head4 C<< foobar!\n\t>>\n\n");

print "# Wrapping up... one for the road...\n";
ok 1;
print "# --- Done with ", __FILE__, " --- \n";