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