Commit | Line | Data |
351625bd |
1 | BEGIN { |
2 | if($ENV{PERL_CORE}) { |
3 | chdir 't'; |
4 | @INC = '../lib'; |
5 | } |
6 | } |
7 | |
8 | use strict; |
9 | use Test; |
69473a20 |
10 | BEGIN { plan tests => 14 }; |
351625bd |
11 | |
12 | #use Pod::Simple::Debug (6); |
13 | |
14 | ok 1; |
15 | |
16 | use Pod::Simple::XMLOutStream; |
17 | print "# Pod::Simple version $Pod::Simple::VERSION\n"; |
18 | my $x = 'Pod::Simple::XMLOutStream'; |
19 | sub e ($$) { $x->_duo(@_) } |
20 | |
21 | $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; |
22 | $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output |
23 | |
24 | |
25 | print "# S as such...\n"; |
26 | |
27 | ok( $x->_out("=pod\n\nI like S<bric-a-brac>.\n"), |
28 | => '<Document><Para>I like <S>bric-a-brac</S>.</Para></Document>' ); |
29 | ok( $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>' ); |
31 | ok( $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 | |
34 | my $unless_ascii = (chr(65) eq 'A') ? '' : |
35 | "Skip because not in ASCIIland"; |
36 | |
37 | skip( $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 a gogo.</Para></Document>' |
41 | ); |
42 | skip( $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">"bric-a-brac a gogo"</L>.</Para></Document>' |
46 | ); |
47 | skip( $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 like that</L>.</Para></Document>' |
51 | ); |
52 | skip( $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 <I>like 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 |
79 | use Pod::Simple::Text; |
80 | $x = Pod::Simple::Text->new; |
81 | $x->preserve_whitespace(1); |
82 | # RT#25679 |
83 | ok( |
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 |
87 | Both 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 |
92 | END |
93 | ), |
94 | <<END |
95 | The Tk::mega manpage showed me how S< > foo is being rendered |
96 | |
97 | Both pod2text and pod2man lose the rest of the line |
98 | |
99 | Do they always lose the rest of the line? |
100 | |
101 | END |
102 | ); |
351625bd |
103 | |
104 | print "# Wrapping up... one for the road...\n"; |
105 | ok 1; |
106 | print "# --- Done with ", __FILE__, " --- \n"; |
107 | |