BEGIN {
if($ENV{PERL_CORE}) {
chdir 't';
@INC = '../lib';
}
}
use strict;
use Test;
BEGIN { plan tests => 21 };
#use Pod::Simple::Debug (5);
ok 1;
use Pod::Simple::DumpAsXML;
use Pod::Simple::XMLOutStream;
print "# Pod::Simple version $Pod::Simple::VERSION\n";
sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
my $x = 'Pod::Simple::XMLOutStream';
$Pod::Simple::XMLOutStream::ATTR_PAD = ' ';
$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
sub moj {shift->accept_target('mojojojo')}
sub mojtext {shift->accept_target_as_text('mojojojo')}
sub any {shift->accept_target('*')}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ok( $x->_out( "=pod\n\nI like pie.\n\n=for mojojojo stuff\n\nYup.\n"),
'I like pie.Yup.'
);
ok( $x->_out( "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk stuff\n\nYup.\n"),
'I like pie.Yup.'
);
ok( $x->_out( "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"),
'I like pie.Yup.'
);
ok( $x->_out( "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.Yup.'
);
ok( $x->_out( "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.Yup.'
);
print "# Testing accept_target ...\n";
ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for crunk stuff\n\nYup.\n"),
'I like pie.Yup.'
);
ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"),
'I like pie.I<stuff>Yup.'
);
ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.I<stuff>Yup.'
);
ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"),
'I like pie.stuffYup.'
);
ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.stuffYup.'
);
print "# Testing accept_target_as_text ...\n";
ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"),
'I like pie.stuffYup.'
);
ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.stuffYup.'
);
ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"),
'I like pie.stuffYup.'
);
ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.stuffYup.'
);
print "# Testing accept_target(*) ...\n";
ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"),
'I like pie.I<stuff>Yup.'
);
ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"),
'I like pie.I<stuff>Yup.'
);
ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.I<stuff>Yup.'
);
ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"),
'I like pie.stuffYup.'
);
ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"),
'I like pie.stuffYup.'
);
print "# Wrapping up... one for the road...\n";
ok 1;
print "# --- Done with ", __FILE__, " --- \n";