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 => 62 }; |
351625bd |
11 | |
12 | my $d; |
13 | #use Pod::Simple::Debug (\$d, 0); |
14 | |
15 | |
16 | ok 1; |
17 | |
18 | use Pod::Simple::DumpAsXML; |
19 | use Pod::Simple::XMLOutStream; |
20 | print "# Pod::Simple version $Pod::Simple::VERSION\n"; |
21 | sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) } |
22 | |
23 | my $x = 'Pod::Simple::XMLOutStream'; |
24 | $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; |
25 | $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output |
26 | |
27 | |
28 | sub moj {$_[0]->accept_target('mojojojo')} |
29 | sub mojtext {$_[0]->accept_target_as_text('mojojojo')} |
30 | sub any {$_[0]->accept_target_as_text('*')} |
31 | |
32 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
33 | print "# Testing non-matching complaint...\n"; |
34 | { |
35 | |
36 | my $out; |
37 | ok( ($out = $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nStuff\n\n=end blorp\n\nYup.\n")) |
38 | =~ m/POD ERRORS/ |
39 | ) or print "# Didn't contain POD ERRORS:\n# $out\n"; |
40 | |
41 | ok( ($out = $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nStuff\n\n=end :blorp\n\nYup.\n")) |
42 | =~ m/POD ERRORS/ |
43 | ) or print "# Didn't contain POD ERRORS:\n# $out\n"; |
44 | ok( ($out = $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n=begin :zaz\n\nStuff\n\n=end :blorp\n\nYup.\n")) |
45 | =~ m/POD ERRORS/ |
46 | ) or print "# Didn't contain POD ERRORS:\n# $out\n"; |
47 | |
48 | } |
49 | |
50 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
51 | |
52 | |
53 | print "# Testing some trivial cases of non-acceptance...\n"; |
54 | |
55 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nStuff\n\n=end mojojojo\n\nYup.\n"), |
56 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
57 | ); |
58 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\nStuff\n\n=end mojojojo\n\nYup.\n"), |
59 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
60 | ); |
61 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\nStuff\n\n=end :mojojojo\n\nYup.\n"), |
62 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
63 | ); |
64 | |
65 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n Stuff\n\n=end mojojojo\n\nYup.\n"), |
66 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
67 | ); |
68 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\n Stuff\n\n=end mojojojo\n\nYup.\n"), |
69 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
70 | ); |
71 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\n Stuff\n\n=end :mojojojo\n\nYup.\n"), |
72 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
73 | ); |
74 | |
75 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<Stuff>\n\n=end mojojojo\n\nYup.\n"), |
76 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
77 | ); |
78 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\nI<Stuff>\n\n=end mojojojo\n\nYup.\n"), |
79 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
80 | ); |
81 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\nI<Stuff>\n\n=end :mojojojo\n\nYup.\n"), |
82 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
83 | ); |
84 | |
85 | |
86 | |
87 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nStuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
88 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
89 | ); |
90 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\nStuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
91 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
92 | ); |
93 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\nStuff\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
94 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
95 | ); |
96 | |
97 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n Stuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
98 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
99 | ); |
100 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\n Stuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
101 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
102 | ); |
103 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\n Stuff\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
104 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
105 | ); |
106 | |
107 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<Stuff>\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
108 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
109 | ); |
110 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\nI<Stuff>\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
111 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
112 | ); |
113 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\nI<Stuff>\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
114 | '<Document><Para>I like pie.</Para><Para>Yup.</Para></Document>' |
115 | ); |
116 | |
351625bd |
117 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
118 | |
119 | print "# Testing matching because of negated non-acceptance...\n"; |
120 | #$d = 5; |
121 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), |
122 | '<Document><Para>I like pie.</Para><for target="!crunk" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
123 | ); |
124 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), |
125 | '<Document><Para>I like pie.</Para><for target="!crunk" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
126 | ); |
127 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nstuff\n\n=end !mojojojo\n\nYup.\n"), |
128 | '<Document><Para>I like pie.</Para><for target="!mojojojo" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
129 | ); |
130 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nI<stuff>\n\n=end !mojojojo\n\nYup.\n"), |
131 | '<Document><Para>I like pie.</Para><for target="!mojojojo" target_matching="!"><Data xml:space="preserve">I<stuff></Data></for><Para>Yup.</Para></Document>' |
132 | ); |
133 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !:mojojojo\n\nI<stuff>\n\n=end !:mojojojo\n\nYup.\n"), |
134 | '<Document><Para>I like pie.</Para><for target="!:mojojojo" target_matching="!"><Para><I>stuff</I></Para></for><Para>Yup.</Para></Document>' |
135 | ); |
136 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :!mojojojo \n\nI<stuff>\n\n=end :!mojojojo \t \n\nYup.\n"), |
137 | '<Document><Para>I like pie.</Para><for target=":!mojojojo" target_matching="!"><Para><I>stuff</I></Para></for><Para>Yup.</Para></Document>' |
138 | ); |
139 | |
140 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !crunk,zaz\n\nstuff\n\n=end !crunk,zaz\n\nYup.\n"), |
141 | '<Document><Para>I like pie.</Para><for target="!crunk,zaz" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
142 | ); |
143 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), |
144 | '<Document><Para>I like pie.</Para><for target="!crunk" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
145 | ); |
146 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), |
147 | '<Document><Para>I like pie.</Para><for target="!crunk" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
148 | ); |
149 | ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), |
150 | '<Document><Para>I like pie.</Para><for target="!crunk" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
151 | ); |
152 | |
153 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nstuff\n\n=end !mojojojo\n\nYup.\n"), |
154 | '<Document><Para>I like pie.</Para><for target="!mojojojo" target_matching="!"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
155 | ); |
156 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nI<stuff>\n\n\n=end !mojojojo\n\nYup.\n"), |
157 | '<Document><Para>I like pie.</Para><for target="!mojojojo" target_matching="!"><Data xml:space="preserve">I<stuff></Data></for><Para>Yup.</Para></Document>' |
158 | ); |
159 | |
160 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !psketti,mojojojo,crunk\n\n\nI<stuff>\n\n=end !psketti,mojojojo,crunk\n\nYup.\n"), |
161 | '<Document><Para>I like pie.</Para><for target="!psketti,mojojojo,crunk" target_matching="!"><Data xml:space="preserve">I<stuff></Data></for><Para>Yup.</Para></Document>' |
162 | ); |
163 | ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !:psketti,mojojojo,crunk\n\nI<stuff>\n\n=end !:psketti,mojojojo,crunk\n\nYup.\n"), |
164 | '<Document><Para>I like pie.</Para><for target="!:psketti,mojojojo,crunk" target_matching="!"><Para><I>stuff</I></Para></for><Para>Yup.</Para></Document>' |
165 | ); |
166 | |
167 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
168 | |
169 | print "# Testing accept_target + simple ...\n"; |
170 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\n\n=end mojojojo \n\nYup.\n"), |
171 | '<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data></for><Para>Yup.</Para></Document>' |
172 | ); |
173 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\n=end psketti,mojojojo,crunk \n\nYup.\n"), |
174 | '<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data></for><Para>Yup.</Para></Document>' |
175 | ); |
176 | |
177 | print "# Testing accept_target_as_text + simple ...\n"; |
178 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\n\n=end mojojojo \n\nYup.\n"), |
179 | '<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Para><I>stuff</I></Para></for><Para>Yup.</Para></Document>' |
180 | ); |
181 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\n=end psketti,mojojojo,crunk \n\nYup.\n"), |
182 | '<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Para><I>stuff</I></Para></for><Para>Yup.</Para></Document>' |
183 | ); |
184 | |
185 | print "# Testing accept_target + two simples ...\n"; |
186 | #$d = 10; |
187 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\n\nHm, B<things>!\n\n=end mojojojo\n\n\nYup.\n"), |
188 | '<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve">Hm, B<things>!</Data></for><Para>Yup.</Para></Document>' |
189 | ); |
190 | |
191 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\nHm, B<things>!\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
192 | '<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve">Hm, B<things>!</Data></for><Para>Yup.</Para></Document>' |
193 | ); |
194 | |
195 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nI<stuff>\n\nHm, B<things>!\n\n=end :mojojojo\n\nYup.\n"), |
196 | '<Document><Para>I like pie.</Para><for target=":mojojojo" target_matching="mojojojo"><Para><I>stuff</I></Para><Para>Hm, <B>things</B>!</Para></for><Para>Yup.</Para></Document>' |
197 | ); |
198 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI<stuff>\n\nHm, B<things>!\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
199 | '<Document><Para>I like pie.</Para><for target=":psketti,mojojojo,crunk" target_matching="mojojojo"><Para><I>stuff</I></Para><Para>Hm, <B>things</B>!</Para></for><Para>Yup.</Para></Document>' |
200 | ); |
201 | |
202 | print "# Testing accept_target_as_text + two simples ...\n"; |
203 | |
204 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\nHm, B<things>!\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
205 | '<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Para><I>stuff</I></Para><Para>Hm, <B>things</B>!</Para></for><Para>Yup.</Para></Document>' |
206 | ); |
207 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI<stuff>\n\nHm, B<things>!\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
208 | '<Document><Para>I like pie.</Para><for target=":psketti,mojojojo,crunk" target_matching="mojojojo"><Para><I>stuff</I></Para><Para>Hm, <B>things</B>!</Para></for><Para>Yup.</Para></Document>' |
209 | ); |
210 | |
211 | |
212 | |
213 | print "# Testing accept_target + two simples, latter with leading whitespace ...\n"; |
214 | #$d = 10; |
215 | |
216 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\n\n Hm, B<things>!\nTrala.\n\n=end mojojojo\n\n\nYup.\n"), |
217 | qq{<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve"> Hm, B<things>!\nTrala.\n</Data></for><Para>Yup.</Para></Document>} |
218 | ); |
219 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\n Hm, B<things>!\nTrala.\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
220 | qq{<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve"> Hm, B<things>!\nTrala.\n</Data></for><Para>Yup.</Para></Document>} |
221 | ); |
222 | |
223 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\n\n Hm, B<things>!\nTrala.\n\n\n=end mojojojo\n\n\nYup.\n"), |
224 | qq{<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve"> Hm, B<things>!\nTrala.\n\n</Data></for><Para>Yup.</Para></Document>} |
225 | ); |
226 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI<stuff>\n\n Hm, B<things>!\nTrala.\n\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), |
227 | qq{<Document><Para>I like pie.</Para><for target="psketti,mojojojo,crunk" target_matching="mojojojo"><Data xml:space="preserve">I<stuff></Data><Data xml:space="preserve"> Hm, B<things>!\nTrala.\n\n</Data></for><Para>Yup.</Para></Document>} |
228 | ); |
229 | |
230 | |
231 | print "# Testing :-target and accept_target + two simples, latter with leading whitespace ...\n"; |
232 | |
233 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nI<stuff>\nTrala!\n\n Hm, B<things>!\nTrala.\n\n=end :mojojojo\n\nYup.\n"), |
234 | qq{<Document><Para>I like pie.</Para><for target=":mojojojo" target_matching="mojojojo"><Para><I>stuff</I> Trala!</Para><Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>} |
235 | ); |
236 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI<stuff>\nTrala!\n\n Hm, B<things>!\nTrala.\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), |
237 | qq{<Document><Para>I like pie.</Para><for target=":psketti,mojojojo,crunk" target_matching="mojojojo"><Para><I>stuff</I> Trala!</Para><Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>} |
238 | ); |
239 | |
240 | print "# now with accept_target_as_text\n"; |
241 | ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI<stuff>\nTrala!\n\n Hm, B<things>!\nTrala.\n\n=end mojojojo\n\nYup.\n"), |
242 | qq{<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo"><Para><I>stuff</I> Trala!</Para><Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>} |
243 | ); |
244 | ok( $x->_out( \&mojtext, join "\n\n" => |
245 | "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk", |
246 | "I<stuff>\nTrala!", |
247 | " Hm, B<things>!\nTrala.", |
248 | "=end psketti,mojojojo,crunk", |
249 | "Yup.\n" |
250 | ), |
251 | qq{<Document><Para>I like pie.</Para>}. |
252 | qq{<for target="psketti,mojojojo,crunk" target_matching="mojojojo">}. |
253 | qq{<Para><I>stuff</I> Trala!</Para>}. |
254 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.</Verbatim>}. |
255 | qq{</for><Para>Yup.</Para></Document>} |
256 | ); |
257 | |
258 | print "# Now with five paragraphs (p,v,v,p,p) and accept_target_as_text\n"; |
259 | |
260 | ok( $x->_out( \&mojtext, join "\n\n" => |
261 | "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk", |
262 | "I<stuff>\nTrala!", |
263 | " Hm, B<things>!\nTrala.", |
264 | " Oh, F<< dodads >>!\nHurf.", |
265 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
266 | "Woohah S<thwack\nwoohah>squim!", |
267 | "=end psketti,mojojojo,crunk", |
268 | "Yup.\n" |
269 | ), |
270 | qq{<Document><Para>I like pie.</Para>}. |
271 | qq{<for target="psketti,mojojojo,crunk" target_matching="mojojojo">}. |
272 | qq{<Para><I>stuff</I> Trala!</Para>}. |
273 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
274 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
275 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
276 | qq{<Para>Woohah <S>thwack woohah</S>squim!</Para>}. |
277 | qq{</for><Para>Yup.</Para></Document>} |
278 | ); |
279 | |
280 | |
281 | |
282 | print "#\n# Now nested begin...end regions...\n"; |
283 | |
284 | sub mojprok { shift->accept_targets(qw{mojojojo prok}) } |
285 | |
286 | ok( $x->_out( \&mojprok, join "\n\n" => |
287 | "=pod\n\nI like pie.", |
288 | "=begin :psketti,mojojojo,crunk", |
289 | "I<stuff>\nTrala!", |
290 | " Hm, B<things>!\nTrala.", |
291 | " Oh, F<< dodads >>!\nHurf.", |
292 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
293 | "=begin :prok", |
294 | "Woohah S<thwack\nwoohah>squim!", |
295 | "=end :prok", |
296 | "ZubZ<>aaz.", |
297 | "=end :psketti,mojojojo,crunk", |
298 | "Yup.\n" |
299 | ), |
300 | qq{<Document><Para>I like pie.</Para>}. |
301 | qq{<for target=":psketti,mojojojo,crunk" target_matching="mojojojo">}. |
302 | qq{<Para><I>stuff</I> Trala!</Para>}. |
303 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
304 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
305 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
306 | qq{<for target=":prok" target_matching="prok">}. |
307 | qq{<Para>Woohah <S>thwack woohah</S>squim!</Para>}. |
308 | qq{</for>}. |
309 | qq{<Para>Zubaaz.</Para>}. |
310 | qq{</for>}. |
311 | qq{<Para>Yup.</Para></Document>} |
312 | ); |
313 | |
314 | |
315 | print "# a little more complex this time...\n"; |
316 | |
317 | ok( $x->_out( \&mojprok, join "\n\n" => |
318 | "=pod\n\nI like pie.", |
319 | "=begin :psketti,mojojojo,crunk", |
320 | "I<stuff>\nTrala!", |
321 | " Hm, B<things>!\nTrala.", |
322 | " Oh, F<< dodads >>!\nHurf.", |
323 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
324 | "=begin :prok", |
325 | " Blorp, B<things>!\nTrala.", |
326 | " Khh, F<< dodads >>!\nHurf.", |
327 | "Woohah S<thwack\nwoohah>squim!", |
328 | "=end :prok", |
329 | "ZubZ<>aaz.", |
330 | "=end :psketti,mojojojo,crunk", |
331 | "Yup.\n" |
332 | ), |
333 | qq{<Document><Para>I like pie.</Para>}. |
334 | qq{<for target=":psketti,mojojojo,crunk" target_matching="mojojojo">}. |
335 | qq{<Para><I>stuff</I> Trala!</Para>}. |
336 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
337 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
338 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
339 | qq{<for target=":prok" target_matching="prok">}. |
340 | qq{<Verbatim xml:space="preserve"> Blorp, B<things>!\nTrala.\n\n}. |
341 | qq{ Khh, F<< dodads >>!\nHurf.</Verbatim>}. |
342 | qq{<Para>Woohah <S>thwack woohah</S>squim!</Para>}. |
343 | qq{</for>}. |
344 | qq{<Para>Zubaaz.</Para>}. |
345 | qq{</for>}. |
346 | qq{<Para>Yup.</Para></Document>} |
347 | ); |
348 | |
349 | |
350 | $d = 10; |
351 | print "# Now with nesting where inner region is non-resolving...\n"; |
352 | |
353 | ok( $x->_out( \&mojprok, join "\n\n" => |
354 | "=pod\n\nI like pie.", |
355 | "=begin :psketti,mojojojo,crunk", |
356 | "I<stuff>\nTrala!", |
357 | " Hm, B<things>!\nTrala.", |
358 | " Oh, F<< dodads >>!\nHurf.", |
359 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
360 | "=begin prok", |
361 | " Blorp, B<things>!\nTrala.", |
362 | " Khh, F<< dodads >>!\nHurf.", |
363 | "Woohah S<thwack\nwoohah>squim!", |
364 | "=end prok", |
365 | "ZubZ<>aaz.", |
366 | "=end :psketti,mojojojo,crunk", |
367 | "Yup.\n" |
368 | ), |
369 | qq{<Document><Para>I like pie.</Para>}. |
370 | qq{<for target=":psketti,mojojojo,crunk" target_matching="mojojojo">}. |
371 | qq{<Para><I>stuff</I> Trala!</Para>}. |
372 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
373 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
374 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
375 | qq{<for target="prok" target_matching="prok">}. |
376 | qq{<Data xml:space="preserve"> Blorp, B<things>!\nTrala.\n\n}. |
377 | qq{ Khh, F<< dodads >>!\nHurf.\n</Data>}. |
378 | qq{<Data xml:space="preserve">Woohah S<thwack\nwoohah>squim!</Data>}. |
379 | qq{</for>}. |
380 | qq{<Para>Zubaaz.</Para>}. |
381 | qq{</for>}. |
382 | qq{<Para>Yup.</Para></Document>} |
383 | ); |
384 | |
385 | |
386 | |
387 | print "# Now a begin...end with a non-resolving for inside\n"; |
388 | |
389 | ok( $x->_out( \&mojprok, join "\n\n" => |
390 | "=pod\n\nI like pie.", |
391 | "=begin :psketti,mojojojo,crunk", |
392 | "I<stuff>\nTrala!", |
393 | " Hm, B<things>!\nTrala.", |
394 | " Oh, F<< dodads >>!\nHurf.", |
395 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
396 | "=for prok" |
397 | . " Blorp, B<things>!\nTrala.\n Khh, F<< dodads >>!\nHurf.", |
398 | "ZubZ<>aaz.", |
399 | "=end :psketti,mojojojo,crunk", |
400 | "Yup.\n" |
401 | ), |
402 | qq{<Document><Para>I like pie.</Para>}. |
403 | qq{<for target=":psketti,mojojojo,crunk" target_matching="mojojojo">}. |
404 | qq{<Para><I>stuff</I> Trala!</Para>}. |
405 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
406 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
407 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
408 | qq{<for target="prok" target_matching="prok">}. |
409 | qq{<Data xml:space="preserve">Blorp, B<things>!\nTrala.\n}. |
410 | qq{ Khh, F<< dodads >>!\nHurf.</Data>}. |
411 | qq{</for>}. |
412 | qq{<Para>Zubaaz.</Para>}. |
413 | qq{</for>}. |
414 | qq{<Para>Yup.</Para></Document>} |
415 | ); |
416 | |
417 | |
418 | |
419 | |
420 | print "# Now a begin...end with a resolving for inside\n"; |
421 | |
422 | ok( $x->_out( \&mojprok, join "\n\n" => |
423 | "=pod\n\nI like pie.", |
424 | "=begin :psketti,mojojojo,crunk", |
425 | "I<stuff>\nTrala!", |
426 | " Hm, B<things>!\nTrala.", |
427 | " Oh, F<< dodads >>!\nHurf.", |
428 | "Boing C<spr-\t\n\t\t\toink>\n Blorg!", |
429 | "=for :prok" |
430 | . " Blorp, B<things>!\nTrala.\n Khh, F<< dodads >>!\nHurf.", |
431 | "ZubZ<>aaz.", |
432 | "=end :psketti,mojojojo,crunk", |
433 | "Yup.\n" |
434 | ), |
435 | qq{<Document><Para>I like pie.</Para>}. |
436 | qq{<for target=":psketti,mojojojo,crunk" target_matching="mojojojo">}. |
437 | qq{<Para><I>stuff</I> Trala!</Para>}. |
438 | qq{<Verbatim xml:space="preserve"> Hm, B<things>!\nTrala.\n\n}. |
439 | qq{ Oh, F<< dodads >>!\nHurf.</Verbatim>}. |
440 | qq{<Para>Boing <C>spr- oink</C> Blorg!</Para>}. |
441 | qq{<for target=":prok" target_matching="prok">}. |
442 | qq{<Para>Blorp, <B>things</B>! Trala. Khh, }. |
443 | qq{<F>dodads</F>! Hurf.</Para>}. |
444 | qq{</for>}. |
445 | qq{<Para>Zubaaz.</Para>}. |
446 | qq{</for>}. |
447 | qq{<Para>Yup.</Para></Document>} |
448 | ); |
449 | |
69473a20 |
450 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
351625bd |
451 | |
69473a20 |
452 | print "# Testing matching of begin block titles\n"; |
453 | ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo Title\n\nstuff\n\n=end mojojojo \n\nYup.\n"), |
454 | '<Document><Para>I like pie.</Para><for target="mojojojo" target_matching="mojojojo" title="Title"><Data xml:space="preserve">stuff</Data></for><Para>Yup.</Para></Document>' |
455 | ); |
351625bd |
456 | |
69473a20 |
457 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
351625bd |
458 | |
459 | print "# Wrapping up... one for the road...\n"; |
460 | ok 1; |
461 | print "# --- Done with ", __FILE__, " --- \n"; |
462 | |