# fcodes S BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 80 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; sub e { $x->_duo(@_) } $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "# S as such...\n"; ok( $x->_out("=pod\n\nI like S.\n"), => 'I like bric-a-brac.' ); ok( $x->_out("=pod\n\nI like S.\n"), => 'I like bric-a-brac a gogo .' ); ok( $x->_out("=pod\n\nI like S<< bric-a-brac a gogo >>.\n"), => 'I like bric-a-brac a gogo.' ); my $unless_ascii = (chr(65) eq 'A') ? '' : "Skip because not in ASCIIland"; skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, "=pod\n\nI like S.\n"), 'I like bric-a-brac a gogo.' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}), 'I like "bric-a-brac a gogo".' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}), 'I like Stuff like that.' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S|/"bric-a-brac a gogo">>.\n}), 'I like Stuff like that.' ); &ok( $x->_duo( sub { $_[0]->nbsp_for_S(1) }, "=pod\n\nI like S.\n", "=pod\n\nI like bric-a-bracE<160>aE<160>gogo.\n", )); &ok( map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}, qq{=pod\n\nI like L<"bric-a-bracE<160>aE<160>gogo"|/"bric-a-brac a gogo">.\n}, )); &ok( map {my $z = $_; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}, qq{=pod\n\nI like LlikeE<160>that|"bric-a-brac a gogo">.\n}, )); &ok( map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S|"bric-a-brac a gogo">>.\n}, qq{=pod\n\nI like LIthat>|"bric-a-brac a gogo">.\n}, )); use Pod::Simple::Text; $x = Pod::Simple::Text->new; $x->preserve_whitespace(1); # RT#25679 ok( $x->_out(< > foo >> is being rendered Both pod2text and pod2man S< > lose the rest of the line =head1 Do they always S< > lose the rest of the line? =cut END ), < foo is being rendered Both pod2text and pod2man lose the rest of the line Do they always lose the rest of the line? END ); $x = 'Pod::Simple::Text'; # Test text output of links. ok( $x->_out(qq{=pod\n\nL\n}), " Net::Ping\n\n" ); ok( $x->_out(qq{=pod\n\nBe sure to read the L docs\n}), " Be sure to read the Net::Ping docs\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.com\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " crontab(5)\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), qq{ "Ping-pong" in Net::Ping\n\n} ); ok( $x->_out(qq{=pod\n\nL\n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nL\n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nL<"Object Methods">\n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nLong>\n}), qq{ "Ping-pong" in Net::Ping\n\n} ); ok( $x->_out(qq{=pod\n\nL\n}), " news:comp.lang.perl.misc\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nSee L\n}), " See http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/\n\n" ); ok( $x->_out(qq{=pod\n\nLlang.perl.misc>\n}), " news:comp.lang.perl.misc\n\n" ); ok( $x->_out(qq{=pod\n\nLperl.org>\n}), " http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " things\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " things\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " perl.org \n\n" ); ok( $x->_out(qq{=pod\n\nSee L\n}), " See perl.org \n\n" ); # Test HTML output of links. use Pod::Simple::HTML; my $PERLDOC = "https://metacpan.org/pod"; my $MANURL = "http://man.he.net/man"; sub x { Pod::Simple::HTML->_out( sub { $_[0]->bare_output(1) }, "=pod\n\n$_[0]", ) } ok( x(qq{L\n}), qq{\n

Net::Ping

\n} ); ok( x(qq{Be sure to read the L docs\n}), qq{\n

Be sure to read the Net::Ping docs

\n} ); ok( x(qq{L\n}), qq{\n

http://www.perl.com

\n} ); ok( x(qq{L\n}), qq{\n

crontab(5)

\n} ); ok( x(qq{L\n}), qq{\n

"Ping-pong" in Net::Ping

\n} ); ok( x(qq{L\n}), qq{\n

"Object Methods"

\n} ); ok( x(qq{L\n}), qq{\n

"Object Methods"

\n} ); ok( x(qq{L<"Object Methods">\n}), qq{\n

"Object Methods"

\n} ); ok( x(qq{Long>\n}), qq{\n

"Ping-pong" in Net::Ping

\n} ); ok( x(qq{L\n}), qq{\n

news:comp.lang.perl.misc

\n} ); ok( x(qq{L\n}), qq{\n

http://www.perl.org

\n} ); ok( x(qq{See L\n}), qq{\n

See http://www.perl.org

\n} ); ok( x(qq{L\n}), qq{\n

http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/

\n} ); ok( x(qq{Llang.perl.misc>\n}), qq{\n

news:comp.lang.perl.misc

\n} ); ok( x(qq{Lperl.org>\n}), qq{\n

http://www.perl.org

\n} ); ok( x(qq{L\n}), qq{\n

things

\n} ); ok( x(qq{L\n}), qq{\n

things

\n} ); ok( x(qq{L\n}), qq{\n

Perl Error Messages

\n} ); ok( x(qq{L\n}), qq{\n

Perl Error Messages

\n} ); ok( x(qq{L\n}), qq{\n

Perl Error Messages

\n} ); ok( x(qq{L\n}), qq{\n

perl.org

\n} ); ok( x(qq{See L\n}), qq{\n

See perl.org

\n} ); # Test link output in XHTML. use Pod::Simple::XHTML; sub o ($) { my $p = Pod::Simple::XHTML->new; $p->html_header(""); $p->html_footer(""); my $results = ''; $p->output_string( \$results ); # Send the resulting output to a string $p->parse_string_document("=pod\n\n$_[0]"); return $results; } ok( o(qq{L}), qq{

Net::Ping

\n\n} ); ok( o(qq{Be sure to read the L docs}), qq{

Be sure to read the Net::Ping docs

\n\n} ); ok( o(qq{L}), qq{

http://www.perl.com

\n\n} ); ok( o(qq{L}), qq{

crontab(5)

\n\n} ); ok( o(qq{L}), qq{

"Ping-pong" in Net::Ping

\n\n} ); ok( o(qq{L}), qq{

"Object Methods"

\n\n} ); ok( o(qq{L}), qq{

"Object Methods"

\n\n} ); ok( o(qq{L<"Object Methods">}), qq{

"Object Methods"

\n\n} ); ok( o(qq{Long>}), qq{

"Ping-pong" in Net::Ping

\n\n} ); ok( o(qq{L}), qq{

news:comp.lang.perl.misc

\n\n} ); ok( o(qq{L}), qq{

http://www.perl.org

\n\n} ); ok( o(qq{See L}), qq{

See http://www.perl.org

\n\n} ); ok( o(qq{L}), qq{

http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/

\n\n} ); ok( o(qq{Llang.perl.misc>}), qq{

news:comp.lang.perl.misc

\n\n} ); ok( o(qq{Lperl.org>}), qq{

http://www.perl.org

\n\n} ); ok( o(qq{L}), qq{

things

\n\n} ); ok( o(qq{L}), qq{

things

\n\n} ); ok( o(qq{L}), qq{

Perl Error Messages

\n\n} ); ok( o(qq{L}), qq{

Perl Error Messages

\n\n} ); ok( o(qq{L}), qq{

Perl Error Messages

\n\n} ); ok( o(qq{L}), qq{

perl.org

\n\n} ); ok( o(qq{See L}), qq{

See perl.org

\n\n} ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n";