X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Fi386%2Flibpod-simple-perl%2Flibpod-simple-perl-3.07%2Ft%2Fxhtml01.t;fp=dev%2Fi386%2Flibpod-simple-perl%2Flibpod-simple-perl-3.07%2Ft%2Fxhtml01.t;h=d75605a1ea299f87a7a0fbe2726ef6e6031431f6;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hp=0000000000000000000000000000000000000000;hpb=df794b845212301ea0d267c919232538bfef356a;p=dh-make-perl diff --git a/dev/i386/libpod-simple-perl/libpod-simple-perl-3.07/t/xhtml01.t b/dev/i386/libpod-simple-perl/libpod-simple-perl-3.07/t/xhtml01.t new file mode 100644 index 0000000..d75605a --- /dev/null +++ b/dev/i386/libpod-simple-perl/libpod-simple-perl-3.07/t/xhtml01.t @@ -0,0 +1,351 @@ +#!/usr/bin/perl -w + +# t/xhtml01.t - check basic output from Pod::Simple::XHTML + +BEGIN { + chdir 't' if -d 't'; +} + +use strict; +use lib '../lib'; +use Test::More tests => 26; + +use_ok('Pod::Simple::XHTML') or exit; + +my $parser = Pod::Simple::XHTML->new (); +isa_ok ($parser, 'Pod::Simple::XHTML'); + +my $results; + +my $PERLDOC = "http://search.cpan.org/perldoc?"; + +initialize($parser, $results); +$parser->parse_string_document( "=head1 Poit!" ); +is($results, "

Poit!

\n\n", "head1 level output"); + +initialize($parser, $results); +$parser->parse_string_document( "=head2 I think so Brain." ); +is($results, "

I think so Brain.

\n\n", "head2 level output"); + +initialize($parser, $results); +$parser->parse_string_document( "=head3 I say, Brain..." ); +is($results, "

I say, Brain...

\n\n", "head3 level output"); + +initialize($parser, $results); +$parser->parse_string_document( "=head4 Zort!" ); +is($results, "

Zort!

\n\n", "head4 level output"); + + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +Gee, Brain, what do you want to do tonight? +EOPOD + +is($results, <<'EOHTML', "simple paragraph"); +

Gee, Brain, what do you want to do tonight?

+ +EOHTML + + +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, <<'EOHTML', "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.

+ +EOHTML + +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, <<'EOHTML', "simple bulleted list"); + + +EOHTML + + +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, <<'EOHTML', "numbered list"); +
    + +
  1. 1. P: Gee, Brain, what do you want to do tonight?
  2. + +
  3. 2. B: The same thing we do every night, Pinky. Try to take over the world!
  4. + +
+ +EOHTML + + +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, <<'EOHTML', "list with text headings"); + + +EOHTML + + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + + 1 + 1 = 2; + 2 + 2 = 4; + +EOPOD + +is($results, <<'EOHTML', "code block"); +
  1 + 1 = 2;
+  2 + 2 = 4;
+ +EOHTML + + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a C. +EOPOD +is($results, <<"EOHTML", "code entity in a paragraph"); +

A plain paragraph with a functionname.

+ +EOHTML + + +initialize($parser, $results); +$parser->html_header("\n"); +$parser->html_footer("\n"); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with body tags turned on. +EOPOD +is($results, <<"EOHTML", "adding html body tags"); + + + +

A plain paragraph with body tags turned on.

+ + + + +EOHTML + + +initialize($parser, $results); +$parser->html_css('style.css'); +$parser->html_header(undef); +$parser->html_footer(undef); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with body tags and css tags turned on. +EOPOD +like($results, qr//, +"adding html body tags and css tags"); + + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with S. +EOPOD +is($results, <<"EOHTML", "Non breaking text in a paragraph"); +

A plain paragraph with non breaking text.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a L. +EOPOD +is($results, <<"EOHTML", "Link entity in a paragraph"); +

A plain paragraph with a Newlines.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a L. +EOPOD +is($results, <<"EOHTML", "Link entity in a paragraph"); +

A plain paragraph with a "Newlines" in perlport.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a L. +EOPOD +is($results, <<"EOHTML", "A link in a paragraph"); +

A plain paragraph with a Boo.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a L. +EOPOD +is($results, <<"EOHTML", "A link in a paragraph"); +

A plain paragraph with a http://link.included.here.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with B. +EOPOD +is($results, <<"EOHTML", "Bold text in a paragraph"); +

A plain paragraph with bold text.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with I. +EOPOD +is($results, <<"EOHTML", "Italic text in a paragraph"); +

A plain paragraph with italic text.

+ +EOHTML + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + +A plain paragraph with a F. +EOPOD +is($results, <<"EOHTML", "File name in a paragraph"); +

A plain paragraph with a filename.

+ +EOHTML + + +initialize($parser, $results); +$parser->parse_string_document(<<'EOPOD'); +=pod + + # this header is very important & don't you forget it + my $text = "File is: " . ; +EOPOD +is($results, <<"EOHTML", "Verbatim text with encodable entities"); +
  # this header is very important & don't you forget it
+  my \$text = "File is: " . <FILE>;
+ +EOHTML + +SKIP: for my $use_html_entities (0, 1) { + if ($use_html_entities and not $Pod::Simple::XHTML::HAS_HTML_ENTITIES) { + skip("HTML::Entities not installed", 1); + } + local $Pod::Simple::XHTML::HAS_HTML_ENTITIES = $use_html_entities; + 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 +is($results, <<"EOHTML", "Verbatim text with markup and embedded formatting"); +
  # this header is very important & don't you forget it
+  my \$file = <FILE> || 'Blank!';
+  my \$text = "File is: " . <FILE>;
+ +EOHTML +} + +###################################### + +sub initialize { + $_[0] = Pod::Simple::XHTML->new (); + $_[0]->html_header(""); + $_[0]->html_footer(""); + $_[0]->output_string( \$results ); # Send the resulting output to a string + $_[1] = ''; + return; +}