1BEGIN { 2 if($ENV{PERL_CORE}) { 3 chdir 't'; 4 @INC = '../lib'; 5 } 6} 7 8use strict; 9use Test; 10BEGIN { plan tests => 8 }; 11 12my $d; 13#use Pod::Simple::Debug (\$d, 0); 14 15ok 1; 16 17use Pod::Simple::XMLOutStream; 18use Pod::Simple::DumpAsXML; 19use Pod::Simple::DumpAsText; 20 21my @from = ( 22 'Pod::Simple::XMLOutStream' 23 => '<Document><head1>I LIKE PIE</head1></Document>', 24 25 'Pod::Simple::DumpAsXML' 26 => "<Document>\n <head1>\n I LIKE PIE\n </head1>\n</Document>\n", 27 28 'Pod::Simple::DumpAsText' 29 => "++Document\n ++head1\n * \"I LIKE PIE\"\n --head1\n--Document\n", 30 31); 32 33 34# Might as well test all the classes... 35while(@from) { 36 my($x => $expected) = splice(@from, 0,2); 37 my $more = ''; 38 print "#Testing via class $x, version ", $x->VERSION(), "\n"; 39 my $p = $x->new; 40 my($got, $exp); 41 ok scalar($got = $x->_out( 42 # Mutor: 43 sub { 44 $_[0]->code_handler(sub { $more .= $_[1] . ":" . $_[0] . "\n" } ); 45 $_[0]->cut_handler( sub { $more .= "~" . $_[1] . ":" . $_[0]. "\n" } ); 46 } => join "\n", 47 "", 48 "\t# This is handy...", 49 "=head1 I LIKE PIE", 50 "", 51 "=cut", 52 "use Test::Harness;", 53 "runtests(sort glob 't/*.t');", 54 "", 55 "", 56 )) 57 => scalar($exp = $expected); 58 ; 59 unless($got eq $exp) { 60 print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), 61 "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; 62 } 63 64 ok scalar($got = $more), scalar($exp = join "\n" => 65 "1:", 66 "2:\t# This is handy...", 67 "~5:=cut", 68 "6:use Test::Harness;", 69 "7:runtests(sort glob 't/*.t');", 70 "8:", 71 "", 72 ); 73 unless($got eq $exp) { 74 print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), 75 "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; 76 } 77} 78 79 80print "# Wrapping up... one for the road...\n"; 81ok 1; 82print "# --- Done with ", __FILE__, " --- \n"; 83 84