Upgrade to Pod-Simple-3.06
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / t / fcodes_s.t
CommitLineData
351625bd 1BEGIN {
2 if($ENV{PERL_CORE}) {
3 chdir 't';
4 @INC = '../lib';
5 }
6}
7
8use strict;
9use Test;
69473a20 10BEGIN { plan tests => 14 };
351625bd 11
12#use Pod::Simple::Debug (6);
13
14ok 1;
15
16use Pod::Simple::XMLOutStream;
17print "# Pod::Simple version $Pod::Simple::VERSION\n";
18my $x = 'Pod::Simple::XMLOutStream';
19sub e ($$) { $x->_duo(@_) }
20
21$Pod::Simple::XMLOutStream::ATTR_PAD = ' ';
22$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
23
24
25print "# S as such...\n";
26
27ok( $x->_out("=pod\n\nI like S<bric-a-brac>.\n"),
28 => '<Document><Para>I like <S>bric-a-brac</S>.</Para></Document>' );
29ok( $x->_out("=pod\n\nI like S<bric-a-brac a gogo >.\n"),
30 => '<Document><Para>I like <S>bric-a-brac a gogo </S>.</Para></Document>' );
31ok( $x->_out("=pod\n\nI like S<< bric-a-brac a gogo >>.\n"),
32 => '<Document><Para>I like <S>bric-a-brac a gogo</S>.</Para></Document>' );
33
34my $unless_ascii = (chr(65) eq 'A') ? '' :
35 "Skip because not in ASCIIland";
36
37skip( $unless_ascii,
38 $x->_out( sub { $_[0]->nbsp_for_S(1) },
39 "=pod\n\nI like S<bric-a-brac a gogo>.\n"),
40'<Document><Para>I like bric-a-brac&#160;a&#160;gogo.</Para></Document>'
41);
42skip( $unless_ascii,
43 $x->_out( sub { $_[0]->nbsp_for_S(1) },
44 qq{=pod\n\nI like S<L</"bric-a-brac a gogo">>.\n}),
45'<Document><Para>I like <L content-implicit="yes" section="bric-a-brac a gogo" type="pod">&#34;bric-a-brac&#160;a&#160;gogo&#34;</L>.</Para></Document>'
46);
47skip( $unless_ascii,
48 $x->_out( sub { $_[0]->nbsp_for_S(1) },
49 qq{=pod\n\nI like S<L<Stuff like that|/"bric-a-brac a gogo">>.\n}),
50'<Document><Para>I like <L section="bric-a-brac a gogo" type="pod">Stuff&#160;like&#160;that</L>.</Para></Document>'
51);
52skip( $unless_ascii,
53 $x->_out( sub { $_[0]->nbsp_for_S(1) },
54 qq{=pod\n\nI like S<L<Stuff I<like that>|/"bric-a-brac a gogo">>.\n}),
55'<Document><Para>I like <L section="bric-a-brac a gogo" type="pod">Stuff&#160;<I>like&#160;that</I></L>.</Para></Document>'
56);
57
58&ok( $x->_duo( sub { $_[0]->nbsp_for_S(1) },
59 "=pod\n\nI like S<bric-a-brac a gogo>.\n",
60 "=pod\n\nI like bric-a-bracE<160>aE<160>gogo.\n",
61));
62&ok(
63 map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z }
64 $x->_duo( sub { $_[0]->nbsp_for_S(1) },
65 qq{=pod\n\nI like S<L</"bric-a-brac a gogo">>.\n},
66 qq{=pod\n\nI like L<"bric-a-bracE<160>aE<160>gogo"|/"bric-a-brac a gogo">.\n},
67));
68&ok( $x->_duo( sub { $_[0]->nbsp_for_S(1) },
69 qq{=pod\n\nI like S<L<Stuff like that|"bric-a-brac a gogo">>.\n},
70 qq{=pod\n\nI like L<StuffE<160>likeE<160>that|"bric-a-brac a gogo">.\n},
71));
72&ok(
73 map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z }
74 $x->_duo( sub { $_[0]->nbsp_for_S(1) },
75 qq{=pod\n\nI like S<L<Stuff I<like that>|"bric-a-brac a gogo">>.\n},
76 qq{=pod\n\nI like L<StuffE<160>I<likeE<160>that>|"bric-a-brac a gogo">.\n},
77));
78
69473a20 79use Pod::Simple::Text;
80$x = Pod::Simple::Text->new;
81$x->preserve_whitespace(1);
82# RT#25679
83ok(
84 $x->_out(<<END
85=head1 The Tk::mega manpage showed me how C<< SE<lt> E<gt> foo >> is being rendered
351625bd 86
69473a20 87Both pod2text and pod2man S< > lose the rest of the line
88
89=head1 Do they always S< > lose the rest of the line?
90
91=cut
92END
93 ),
94 <<END
95The Tk::mega manpage showed me how S< > foo is being rendered
96
97 Both pod2text and pod2man lose the rest of the line
98
99Do they always lose the rest of the line?
100
101END
102);
351625bd 103
104print "# Wrapping up... one for the road...\n";
105ok 1;
106print "# --- Done with ", __FILE__, " --- \n";
107