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