Upgrade to Pod-Simple-3.06
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / t / begin.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 => 62 };
351625bd 11
12my $d;
13#use Pod::Simple::Debug (\$d, 0);
14
15
16ok 1;
17
18use Pod::Simple::DumpAsXML;
19use Pod::Simple::XMLOutStream;
20print "# Pod::Simple version $Pod::Simple::VERSION\n";
21sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
22
23my $x = 'Pod::Simple::XMLOutStream';
24$Pod::Simple::XMLOutStream::ATTR_PAD = ' ';
25$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
26
27
28sub moj {$_[0]->accept_target('mojojojo')}
29sub mojtext {$_[0]->accept_target_as_text('mojojojo')}
30sub any {$_[0]->accept_target_as_text('*')}
31
32#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33print "# Testing non-matching complaint...\n";
34{
35
36my $out;
37ok( ($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
41ok( ($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";
44ok( ($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
53print "# Testing some trivial cases of non-acceptance...\n";
54
55ok( $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);
58ok( $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);
61ok( $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
65ok( $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);
68ok( $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);
71ok( $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
75ok( $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);
78ok( $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);
81ok( $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
87ok( $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);
90ok( $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);
93ok( $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
97ok( $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);
100ok( $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);
103ok( $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
107ok( $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);
110ok( $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);
113ok( $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
119print "# Testing matching because of negated non-acceptance...\n";
120#$d = 5;
121ok( $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);
124ok( $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);
127ok( $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);
130ok( $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&#60;stuff&#62;</Data></for><Para>Yup.</Para></Document>'
132);
133ok( $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);
136ok( $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
140ok( $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);
143ok( $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);
146ok( $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);
149ok( $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
153ok( $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);
156ok( $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&#60;stuff&#62;</Data></for><Para>Yup.</Para></Document>'
158);
159
160ok( $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&#60;stuff&#62;</Data></for><Para>Yup.</Para></Document>'
162);
163ok( $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
169print "# Testing accept_target + simple ...\n";
170ok( $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&#60;stuff&#62;</Data></for><Para>Yup.</Para></Document>'
172);
173ok( $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&#60;stuff&#62;</Data></for><Para>Yup.</Para></Document>'
175);
176
177print "# Testing accept_target_as_text + simple ...\n";
178ok( $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);
181ok( $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
185print "# Testing accept_target + two simples ...\n";
186#$d = 10;
187ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve">Hm, B&#60;things&#62;!</Data></for><Para>Yup.</Para></Document>'
189);
190
191ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve">Hm, B&#60;things&#62;!</Data></for><Para>Yup.</Para></Document>'
193);
194
195ok( $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);
198ok( $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
202print "# Testing accept_target_as_text + two simples ...\n";
203
204ok( $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);
207ok( $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
213print "# Testing accept_target + two simples, latter with leading whitespace ...\n";
214#$d = 10;
215
216ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve"> Hm, B&#60;things&#62;!\nTrala.\n</Data></for><Para>Yup.</Para></Document>}
218);
219ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve"> Hm, B&#60;things&#62;!\nTrala.\n</Data></for><Para>Yup.</Para></Document>}
221);
222
223ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve"> Hm, B&#60;things&#62;!\nTrala.\n\n</Data></for><Para>Yup.</Para></Document>}
225);
226ok( $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&#60;stuff&#62;</Data><Data xml:space="preserve"> Hm, B&#60;things&#62;!\nTrala.\n\n</Data></for><Para>Yup.</Para></Document>}
228);
229
230
231print "# Testing :-target and accept_target + two simples, latter with leading whitespace ...\n";
232
233ok( $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&#60;things&#62;!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>}
235);
236ok( $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&#60;things&#62;!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>}
238);
239
240print "# now with accept_target_as_text\n";
241ok( $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&#60;things&#62;!\nTrala.</Verbatim></for><Para>Yup.</Para></Document>}
243);
244ok( $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&#60;things&#62;!\nTrala.</Verbatim>}.
255 qq{</for><Para>Yup.</Para></Document>}
256);
257
258print "# Now with five paragraphs (p,v,v,p,p) and accept_target_as_text\n";
259
260ok( $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&#60;things&#62;!\nTrala.\n\n}.
274 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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
282print "#\n# Now nested begin...end regions...\n";
283
284sub mojprok { shift->accept_targets(qw{mojojojo prok}) }
285
286ok( $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&#60;things&#62;!\nTrala.\n\n}.
304 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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
315print "# a little more complex this time...\n";
316
317ok( $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&#60;things&#62;!\nTrala.\n\n}.
337 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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&#60;things&#62;!\nTrala.\n\n}.
341 qq{ Khh, F&#60;&#60; dodads &#62;&#62;!\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;
351print "# Now with nesting where inner region is non-resolving...\n";
352
353ok( $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&#60;things&#62;!\nTrala.\n\n}.
373 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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&#60;things&#62;!\nTrala.\n\n}.
377 qq{ Khh, F&#60;&#60; dodads &#62;&#62;!\nHurf.\n</Data>}.
378 qq{<Data xml:space="preserve">Woohah S&#60;thwack\nwoohah&#62;squim!</Data>}.
379 qq{</for>}.
380 qq{<Para>Zubaaz.</Para>}.
381 qq{</for>}.
382 qq{<Para>Yup.</Para></Document>}
383);
384
385
386
387print "# Now a begin...end with a non-resolving for inside\n";
388
389ok( $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&#60;things&#62;!\nTrala.\n\n}.
406 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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&#60;things&#62;!\nTrala.\n}.
410 qq{ Khh, F&#60;&#60; dodads &#62;&#62;!\nHurf.</Data>}.
411 qq{</for>}.
412 qq{<Para>Zubaaz.</Para>}.
413 qq{</for>}.
414 qq{<Para>Yup.</Para></Document>}
415);
416
417
418
419
420print "# Now a begin...end with a resolving for inside\n";
421
422ok( $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&#60;things&#62;!\nTrala.\n\n}.
439 qq{ Oh, F&#60;&#60; dodads &#62;&#62;!\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 452print "# Testing matching of begin block titles\n";
453ok( $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
459print "# Wrapping up... one for the road...\n";
460ok 1;
461print "# --- Done with ", __FILE__, " --- \n";
462