Debian lenny version packages
[pkg-perl] / deb-src / libpod-simple-perl / libpod-simple-perl-3.07 / t / heads.t
1 BEGIN {
2     if($ENV{PERL_CORE}) {
3         chdir 't';
4         @INC = '../lib';
5     }
6 }
7
8 use strict;
9 use Test;
10 BEGIN { plan tests => 19 };
11
12 #use Pod::Simple::Debug (6);
13
14 ok 1;
15
16 use Pod::Simple::DumpAsXML;
17 use Pod::Simple::XMLOutStream;
18 print "# Pod::Simple version $Pod::Simple::VERSION\n";
19 sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
20
21
22 print "# Simple tests for head1 - head4...\n";
23 ok( Pod::Simple::XMLOutStream->_out("\n=head1 Chacha\n\n"),
24     '<Document><head1>Chacha</head1></Document>'
25 );
26 ok( Pod::Simple::XMLOutStream->_out("\n=head2 Chacha\n\n"),
27     '<Document><head2>Chacha</head2></Document>'
28 );
29 ok( Pod::Simple::XMLOutStream->_out("\n=head3 Chacha\n\n"),
30     '<Document><head3>Chacha</head3></Document>'
31 );
32 ok( Pod::Simple::XMLOutStream->_out("\n=head4 Chacha\n\n"),
33     '<Document><head4>Chacha</head4></Document>'
34 );
35
36 print "# Testing whitespace equivalence...\n";
37
38 &ok(e "\n=head1 Chacha\n\n", "\n=head1       Chacha\n\n");
39 &ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha\n\n");
40 &ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha      \n\n");
41
42
43
44 ok( Pod::Simple::XMLOutStream->_out("=head1     Chachacha"),
45     '<Document><head1>Chachacha</head1></Document>'
46 );
47
48
49 print "# Testing whitespace variance ...\n";
50 ok( Pod::Simple::XMLOutStream->_out("=head1     Cha cha cha   \n"),
51     '<Document><head1>Cha cha cha</head1></Document>'
52 );
53 ok( Pod::Simple::XMLOutStream->_out("=head1     Cha   cha\tcha   \n"),
54     '<Document><head1>Cha cha cha</head1></Document>'
55 );
56
57
58
59
60 print "# Testing head2, head3, head4 more...\n";
61
62 ok( Pod::Simple::XMLOutStream->_out("=head2     Cha   cha\tcha   \n"),
63     '<Document><head2>Cha cha cha</head2></Document>'
64 );
65 ok( Pod::Simple::XMLOutStream->_out("=head3     Cha   cha\tcha   \n"),
66     '<Document><head3>Cha cha cha</head3></Document>'
67 );
68 ok( Pod::Simple::XMLOutStream->_out("=head4     Cha   cha\tcha   \n"),
69     '<Document><head4>Cha cha cha</head4></Document>'
70 );
71
72 print "# Testing entity expansion...\n";
73
74 ok( Pod::Simple::XMLOutStream->_out("=head4 fooE<64>bar!\n"),
75     Pod::Simple::XMLOutStream->_out("\n=head4  foo\@bar!\n\n"),
76 );
77
78 # TODO: a mode so that DumpAsXML can ask for all contiguous string
79 #  sequences to be fused?
80 # &ok( e "=head4 fooE<64>bar!\n", "\n=head4  foo\@bar!\n\n");
81
82 print "# Testing formatting sequences...\n";
83
84 # True only if the sequences resolve, as they should...
85 &ok( e "=head4 C<foobar!>\n", "\n=head4 C<< foobar!    >>\n\n");
86 &ok( e "=head4 C<foobar!>\n", "\n\n=head4 C<<<  foobar! >>>\n");
87 &ok( e "=head4 C<foobar!>\n", "\n=head4 C<< foobar!\n\t>>\n\n");
88
89 print "# Wrapping up... one for the road...\n";
90 ok 1;
91 print "# --- Done with ", __FILE__, " --- \n";
92