5 BEGIN { plan tests => 11 };
8 #use Pod::Simple::Debug (\$d, 0);
12 use Pod::Simple::XMLOutStream;
13 use Pod::Simple::DumpAsXML;
16 $Pod::Simple::XMLOutStream::ATTR_PAD = ' ';
17 $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
20 print "# A simple sanity test...\n";
21 ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
22 '<Document><Para><F><C>foo</C> <I>bar</I></F> <B>stuff <X>thing</X>baz</B></Para></Document>'
25 print "# With lots of nesting, and Z's...\n";
26 ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
27 '<Document><Para><F><C>foo</C> <I>bar</I></F> <B>stuff <X>thing</X>baz</B></Para></Document>'
30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 sub mergy {$_[0]->merge_text(1)}
33 sub nixy {$_[0]->nix_X_codes(1)}
34 sub nixy_mergy {$_[0]->merge_text(1); $_[0]->nix_X_codes(1);}
36 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38 print "# With no F/X\n";
40 ok( Pod::Simple::DumpAsXML->_out( "=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
69 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71 print "# with just X-nixing...\n";
73 ok( Pod::Simple::DumpAsXML->_out( \&nixy, "=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
99 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 print "# With merging...\n";
103 ok( Pod::Simple::DumpAsXML->_out( \&mergy, "=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
130 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 print "# With nixing and merging...\n";
134 ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>F<C<Z<>fE<111>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
157 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159 # Now the scary bits... with L's!
160 print "# A wee L<...> sanity test...\n";
161 ok( Pod::Simple::XMLOutStream->_out(qq{=pod\n\nL<E<78>et::Ping/Ping-E<112>ong>\n}),
162 '<Document><Para><L content-implicit="yes" section="Ping-pong" to="Net::Ping" type="pod">"Ping-pong" in Net::Ping</L></Para></Document>'
164 print "# Now a wee L<...> with mergy...\n";
168 ok( Pod::Simple::DumpAsXML->_out(\&mergy, qq{=pod\n\nL<E<78>et::Ping/Ping-E<112>ong>\n}),
173 ' <L content-implicit="yes" section="Ping-pong" to="Net::Ping" type="pod">',
174 ' "Ping-pong" in Net::Ping',
182 print "# Now a complex tree with L's, with nixy+mergy...\n";
184 ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>F<C<Z<>fE<111>L<E<78>et::Ping/Ping-E<112>ong>o> I<bar>> B<stuff X<thingZ<>>baz>\n"),
192 ' <L content-implicit="yes" section="Ping-pong" to="Net::Ping" type="pod">',
193 ' "Ping-pong" in Net::Ping',
211 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 print "# Wrapping up... one for the road...\n";
217 print "# --- Done with ", __FILE__, " --- \n";