#!/usr/bin/perl -w # t/docbook.t - check output from Pod::PseudoPod::DocBook BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 27; use_ok('Pod::PseudoPod::DocBook') or exit; my $parser = Pod::PseudoPod::DocBook->new (); isa_ok ($parser, 'Pod::PseudoPod::DocBook'); my $results; initialize($parser, $results); $parser->chapter_num(5); $parser->parse_string_document( <<'EOPOD' ); =head0 Narf! =head1 Poit! =head2 I think so Brain. =head3 I say, Brain... =head3 What do you want to do tonight, Brain? =head4 Zort! =head1 Egads! EOPOD is($results, <<'EODB', "multiple head level output"); Narf! Poit! I think so Brain. I say, Brain... What do you want to do tonight, Brain? Zort! Egads! EODB initialize($parser, $results); $parser->chapter_type('preface'); $parser->parse_string_document( <<'EOPOD' ); =head0 Narf! =head1 Poit! EOPOD is($results, <<'EODB', "multiple head level output (preface chapter)"); Narf! Poit! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is($results, <<'EODB', "simple paragraph"); Gee, Brain, what do you want to do tonight? EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOPOD is($results, <<'EODB', "multiple paragraphs"); B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "simple bulleted list"); P: Gee, Brain, what do you want to do tonight? B: The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "numbered list"); P: Gee, Brain, what do you want to do tonight? B: The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EODB', "list with text headings"); Pinky Gee, Brain, what do you want to do tonight? Brain The same thing we do every night, Pinky. Try to take over the world! EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is($results, <<'EODB', "code block"); 1 + 1 = 2; 2 + 2 = 4; EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a C. EOPOD is($results, <<"EODB", "code entity in a paragraph"); A plain paragraph with a functionname. EODB initialize($parser, $results); $parser->chapter_num(9); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a footnote.N EOPOD is($results, <<"EODB", "footnote entity in a paragraph"); A plain paragraph with a footnote.And the footnote is... EODB initialize($parser, $results); $parser->chapter_type('preface'); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a footnote.N EOPOD is($results, <<"EODB", "footnote entity in a paragraph (preface chapter)"); A plain paragraph with a footnote.And the footnote is... EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a U. EOPOD is($results, <<"EODB", "URL entity in a paragraph"); A plain paragraph with a . EODB TODO: { local $TODO = "waiting for spec from O'Reilly"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a Z. EOPOD is($results, <<"EODB", "Link anchor entity in a paragraph"); A plain paragraph with a . EODB }; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a A. EOPOD is($results, <<"EODB", "Link entity in a paragraph"); A plain paragraph with a . EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a G. EOPOD is($results, <<"EODB", "Superscript in a paragraph"); A plain paragraph with a superscript. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a H. EOPOD is($results, <<"EODB", "Subscript in a paragraph"); A plain paragraph with a subscript. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with B. EOPOD is($results, <<"EODB", "Bold text in a paragraph"); A plain paragraph with bold text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with I. EOPOD is($results, <<"EODB", "Italic text in a paragraph"); A plain paragraph with italic text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with R. EOPOD is($results, <<"EODB", "Replaceable text in a paragraph"); A plain paragraph with replaceable text. EODB initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a F. EOPOD is($results, <<"EODB", "File name in a paragraph"); A plain paragraph with a filename. EODB TODO: { local $TODO = "waiting for spec from O'Reilly"; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =begin author A paragraph inside a block. =end author EOPOD is($results, <<"EODB", "File name in a paragraph"); A paragraph inside a block. EODB }; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod # this header is very important & don't you forget it B || 'Blank!';> my $text = "File is: " . ; EOPOD like($results, qr/"/, "Verbatim text with encodable quotes"); like($results, qr/&/, "Verbatim text with encodable ampersands"); like($results, qr/</, "Verbatim text with encodable less-than"); like($results, qr/>/, "Verbatim text with encodable greater-than"); ###################################### sub initialize { $_[0] = Pod::PseudoPod::DocBook->new (); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; }