use strict; use Test; BEGIN { plan tests => 11 }; my $d; #use Pod::Simple::Debug (\$d, 0); ok 1; use Pod::Simple::XMLOutStream; use Pod::Simple::DumpAsXML; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "# A simple sanity test...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), 'foo bar stuff thingbaz' ); print "# With lots of nesting, and Z's...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), 'foo bar stuff thingbaz' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub mergy {$_[0]->merge_text(1)} sub nixy {$_[0]->nix_X_codes(1)} sub nixy_mergy {$_[0]->merge_text(1); $_[0]->nix_X_codes(1);} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With no F/X\n"; ok( Pod::Simple::DumpAsXML->_out( "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' f', ' o', ' o', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff ', ' ', ' thing', ' ', ' baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# with just X-nixing...\n"; ok( Pod::Simple::DumpAsXML->_out( \&nixy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' f', ' o', ' o', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff ', ' baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With merging...\n"; ok( Pod::Simple::DumpAsXML->_out( \&mergy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff ', ' ', ' thing', ' ', ' baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With nixing and merging...\n"; #$d = 10; ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Now the scary bits... with L's! print "# A wee L<...> sanity test...\n"; ok( Pod::Simple::XMLOutStream->_out(qq{=pod\n\nLet::Ping/Ping-E<112>ong>\n}), '"Ping-pong" in Net::Ping' ); print "# Now a wee L<...> with mergy...\n"; $d = 10; ok( Pod::Simple::DumpAsXML->_out(\&mergy, qq{=pod\n\nLet::Ping/Ping-E<112>ong>\n}), join "\n", '', ' ', ' ', ' "Ping-pong" in Net::Ping', ' ', ' ', '', '' ); print "# Now a complex tree with L's, with nixy+mergy...\n"; ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>FfE<111>Let::Ping/Ping-E<112>ong>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' fo', ' ', ' "Ping-pong" in Net::Ping', ' ', ' o', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n";