xref: /openbsd/gnu/usr.bin/perl/cpan/Pod-Simple/t/basic.t (revision 8932bfb7)
1BEGIN {
2    if($ENV{PERL_CORE}) {
3        chdir 't';
4        @INC = '../lib';
5    }
6}
7
8use strict;
9use Test;
10BEGIN { plan tests => 30 };
11
12#use Pod::Simple::Debug (6);
13
14ok 1;
15
16require Pod::Simple::BlackBox;
17ok 1;
18
19require Pod::Simple; ok 1;
20
21Pod::Simple->VERSION(.90); ok 1;
22
23#print "# Pod::Simple version $Pod::Simple::VERSION\n";
24
25require Pod::Simple::DumpAsXML; ok 1;
26
27require Pod::Simple::XMLOutStream; ok 1;
28
29sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
30
31print "# Simple identity tests...\n";
32
33&ok( e "", "" );
34&ok( e "\n", "", );
35&ok( e "\n", "\n", );
36&ok( e "puppies\n\n\n\n", "", );
37
38
39print "# Contentful identity tests...\n";
40
41&ok( e "=pod\n\nFoo\n",         "=pod\n\nFoo\n"         );
42&ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" );
43&ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\nFoo\n"         );
44
45# Now with some more newlines
46&ok( e "\n\n=pod\n\nFoo\n",     "\n\n=pod\n\nFoo\n"     );
47&ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" );
48&ok( e "=pod\n\n\n\nFoo\n\n\n", "\n\n=pod\n\nFoo\n"     );
49
50
51&ok( e "=head1 Foo\n",          "=head1 Foo\n"          );
52&ok( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n\n=cut\n"  );
53&ok( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n"          );
54
55# Now just add some newlines...
56&ok( e "\n\n\n\n=head1 Foo\n",  "\n\n\n\n=head1 Foo\n"  );
57&ok( e "=head1 Foo\n\n=cut\n",  "=head1 Foo\n\n=cut\n"  );
58&ok( e "=head1 Foo\n\n=cut\n",  "\n\n\n\n=head1 Foo\n"  );
59
60
61print "# Simple XMLification tests...\n";
62
63ok( Pod::Simple::XMLOutStream->_out("\n\n\nprint \$^T;\n\n\n"),
64    qq{<Document\ncontentless="1"></Document>}
65     # make sure the contentless flag is set
66);
67ok( Pod::Simple::XMLOutStream->_out("\n\n"),
68    qq{<Document\ncontentless="1"></Document>}
69     # make sure the contentless flag is set
70);
71ok( Pod::Simple::XMLOutStream->_out("\n"),
72    qq{<Document\ncontentless="1"></Document>}
73     # make sure the contentless flag is set
74);
75ok( Pod::Simple::XMLOutStream->_out(""),
76    qq{<Document\ncontentless="1"></Document>}
77     # make sure the contentless flag is set
78);
79
80ok( Pod::Simple::XMLOutStream->_out('', '<Document></Document>' ) );
81
82ok( Pod::Simple::XMLOutStream->_out("=pod\n\nFoo\n"),
83    '<Document><Para>Foo</Para></Document>'
84);
85
86ok( Pod::Simple::XMLOutStream->_out("=head1 Chacha\n\nFoo\n"),
87    '<Document><head1>Chacha</head1><Para>Foo</Para></Document>'
88);
89
90
91print "# Wrapping up... one for the road...\n";
92ok 1;
93print "# --- Done with ", __FILE__, " --- \n";
94
95
96