1BEGIN { 2 if($ENV{PERL_CORE}) { 3 chdir 't'; 4 @INC = '../lib'; 5 } 6} 7 8use strict; 9use Test; 10BEGIN { plan tests => 19 }; 11 12#use Pod::Simple::Debug (6); 13 14ok 1; 15 16use Pod::Simple::DumpAsXML; 17use Pod::Simple::XMLOutStream; 18print "# Pod::Simple version $Pod::Simple::VERSION\n"; 19sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) } 20 21 22print "# Simple tests for head1 - head4...\n"; 23ok( Pod::Simple::XMLOutStream->_out("\n=head1 Chacha\n\n"), 24 '<Document><head1>Chacha</head1></Document>' 25); 26ok( Pod::Simple::XMLOutStream->_out("\n=head2 Chacha\n\n"), 27 '<Document><head2>Chacha</head2></Document>' 28); 29ok( Pod::Simple::XMLOutStream->_out("\n=head3 Chacha\n\n"), 30 '<Document><head3>Chacha</head3></Document>' 31); 32ok( Pod::Simple::XMLOutStream->_out("\n=head4 Chacha\n\n"), 33 '<Document><head4>Chacha</head4></Document>' 34); 35 36print "# 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 44ok( Pod::Simple::XMLOutStream->_out("=head1 Chachacha"), 45 '<Document><head1>Chachacha</head1></Document>' 46); 47 48 49print "# Testing whitespace variance ...\n"; 50ok( Pod::Simple::XMLOutStream->_out("=head1 Cha cha cha \n"), 51 '<Document><head1>Cha cha cha</head1></Document>' 52); 53ok( Pod::Simple::XMLOutStream->_out("=head1 Cha cha\tcha \n"), 54 '<Document><head1>Cha cha cha</head1></Document>' 55); 56 57 58 59 60print "# Testing head2, head3, head4 more...\n"; 61 62ok( Pod::Simple::XMLOutStream->_out("=head2 Cha cha\tcha \n"), 63 '<Document><head2>Cha cha cha</head2></Document>' 64); 65ok( Pod::Simple::XMLOutStream->_out("=head3 Cha cha\tcha \n"), 66 '<Document><head3>Cha cha cha</head3></Document>' 67); 68ok( Pod::Simple::XMLOutStream->_out("=head4 Cha cha\tcha \n"), 69 '<Document><head4>Cha cha cha</head4></Document>' 70); 71 72print "# Testing entity expansion...\n"; 73 74ok( 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 82print "# 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 89print "# Wrapping up... one for the road...\n"; 90ok 1; 91print "# --- Done with ", __FILE__, " --- \n"; 92 93