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; |
9d65762f |
10 | BEGIN { plan tests => 114 }; |
351625bd |
11 | |
12 | #use Pod::Simple::Debug (5); |
13 | |
14 | #sub Pod::Simple::MANY_LINES () {1} |
15 | #sub Pod::Simple::PullParser::DEBUG () {3} |
16 | |
17 | |
18 | use Pod::Simple::PullParser; |
19 | |
20 | ok 1; |
21 | |
22 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
23 | ########################################################################### |
24 | |
25 | { |
26 | print "# Testing another set, at line ", __LINE__, "\n"; |
27 | |
28 | my $p = Pod::Simple::PullParser->new; |
29 | $p->set_source( \qq{\n=head1 NAME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} ); |
30 | |
31 | ok $p->get_title(), 'Bzorch'; |
9d65762f |
32 | |
351625bd |
33 | my $t; |
34 | |
35 | ok( $t = $p->get_token); |
36 | ok( $t && $t->type, 'start'); |
37 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
38 | |
39 | ok( $t = $p->get_token); |
40 | ok( $t && $t->type, 'start'); |
41 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
42 | |
43 | ok( $t = $p->get_token); |
44 | ok( $t && $t->type, 'text'); |
45 | ok( $t && $t->type eq 'text' && $t->text, 'NAME' ); |
46 | |
47 | } |
48 | |
49 | ########################################################################### |
50 | |
51 | { |
9d65762f |
52 | print "# Testing a set with nocase, at line ", __LINE__, "\n"; |
53 | my $p = Pod::Simple::PullParser->new; |
54 | $p->set_source( \qq{\n=head1 Name\n\nShazbot\n\n=pod\n\nLala\n\n\=cut\n} ); |
55 | |
56 | ok $p->get_title(nocase => 1), 'Shazbot'; |
57 | |
58 | ok( my $t = $p->get_token); |
59 | ok( $t && $t->type, 'start'); |
60 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
61 | |
62 | ok( $t = $p->get_token); |
63 | ok( $t && $t->type, 'start'); |
64 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
65 | |
66 | ok( $t = $p->get_token); |
67 | ok( $t && $t->type, 'text'); |
68 | ok( $t && $t->type eq 'text' && $t->text, 'Name' ); |
69 | |
70 | } |
71 | |
72 | ########################################################################### |
73 | |
74 | { |
351625bd |
75 | print "# Testing another set, at line ", __LINE__, "\n"; |
76 | |
77 | my $p = Pod::Simple::PullParser->new; |
78 | $p->set_source( \qq{\n=head1 NE<65>ME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} ); |
79 | |
80 | ok $p->get_title(), 'Bzorch'; |
81 | my $t; |
82 | |
83 | ok( $t = $p->get_token); |
84 | ok( $t && $t->type, 'start'); |
85 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
86 | |
87 | ok( $t = $p->get_token); |
88 | ok( $t && $t->type, 'start'); |
89 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
90 | |
91 | ok( $t = $p->get_token); |
92 | ok( $t && $t->type, 'text'); |
93 | |
94 | } |
95 | |
96 | |
97 | ########################################################################### |
98 | |
99 | { |
100 | print "# Testing another set, at line ", __LINE__, "\n"; |
101 | |
102 | { |
103 | my $p = Pod::Simple::PullParser->new; |
104 | $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} ); |
105 | ok $p->get_title(), 'Bzorch - thing lala'; |
106 | } |
107 | |
108 | |
109 | my $p = Pod::Simple::PullParser->new; |
110 | $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} ); |
111 | ok $p->get_title(), 'Bzorch - thing lala'; |
112 | |
113 | my $t; |
114 | |
115 | ok( $t = $p->get_token); |
116 | ok( $t && $t->type, 'start'); |
117 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
118 | |
119 | ok( $t = $p->get_token); |
120 | ok( $t && $t->type, 'start'); |
121 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
122 | |
123 | ok( $t = $p->get_token); |
124 | ok( $t && $t->type, 'text'); |
125 | ok( $t && $t->type eq 'text' && $t->text, 'NAME' ); |
126 | |
127 | } |
128 | |
129 | ########################################################################### |
130 | |
131 | { |
132 | print "# Testing another set, at line ", __LINE__, "\n"; |
133 | |
134 | my $p = Pod::Simple::PullParser->new; |
135 | $p->set_source( \qq{\n=head1 Bzorch lala\n\n=pod\n\nLala\n\n\=cut\n} ); |
136 | |
137 | ok $p->get_title(), 'Bzorch lala'; |
138 | my $t; |
139 | |
140 | ok( $t = $p->get_token); |
141 | ok( $t && $t->type, 'start'); |
142 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
143 | |
144 | ok( $t = $p->get_token); |
145 | ok( $t && $t->type, 'start'); |
146 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
147 | |
148 | ok( $t = $p->get_token); |
149 | ok( $t && $t->type, 'text'); |
150 | ok( $t && $t->type eq 'text' && $t->text, 'Bzorch lala' ); |
151 | |
152 | } |
153 | |
154 | ########################################################################### |
155 | |
156 | { |
157 | print "# Testing another set, at line ", __LINE__, "\n"; |
158 | |
159 | my $p = Pod::Simple::PullParser->new; |
160 | $p->set_source( \qq{\n=head1 Bzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} ); |
161 | |
162 | ok $p->get_title(), 'Bzorch - thing lala'; |
163 | my $t; |
164 | |
165 | ok( $t = $p->get_token); |
166 | ok( $t && $t->type, 'start'); |
167 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
168 | |
169 | ok( $t = $p->get_token); |
170 | ok( $t && $t->type, 'start'); |
171 | ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); |
172 | |
173 | ok( $t = $p->get_token); |
174 | ok( $t && $t->type, 'text'); |
175 | ok( $t && $t->type eq 'text' && $t->text, 'Bzorch - ' ); |
176 | |
177 | } |
178 | ########################################################################### |
179 | |
180 | { |
181 | print "# Testing another set, at line ", __LINE__, "\n"; |
182 | |
183 | my $p = Pod::Simple::PullParser->new; |
184 | $p->set_source( \qq{\n=head1 Nombre (NAME)\n\nBzorch - I<thing> lala\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
185 | |
186 | ok $p->get_version || '', ''; |
187 | ok $p->get_author || '', ''; |
188 | |
189 | ok $p->get_title(), 'Bzorch - thing lala'; |
190 | |
191 | my $t; |
192 | ok( $t = $p->get_token); |
193 | ok( $t && $t->type, 'start'); |
194 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
195 | |
196 | } |
197 | ########################################################################### |
198 | |
199 | { |
200 | print "# Testing another set, at line ", __LINE__, "\n"; |
201 | |
202 | my $p = Pod::Simple::PullParser->new; |
203 | $p->set_source( \qq{\n=head1 ëÏÇÄÁ ÞÉÔÁÌÁ (NAME)\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
204 | |
205 | ok $p->get_title(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
206 | my $t; |
207 | |
208 | ok( $t = $p->get_token); |
209 | ok( $t && $t->type, 'start'); |
210 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
211 | |
212 | } |
213 | |
214 | ########################################################################### |
215 | |
216 | { |
217 | print "# Testing another set, at line ", __LINE__, "\n"; |
218 | |
219 | my $p = Pod::Simple::PullParser->new; |
220 | $p->set_source( \qq{\n=head1 (NAME) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
221 | |
222 | ok $p->get_title(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
223 | my $t; |
224 | |
225 | ok( $t = $p->get_token); |
226 | ok( $t && $t->type, 'start'); |
227 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
228 | |
229 | } |
230 | |
231 | ########################################################################### |
232 | |
233 | { |
234 | print "# Testing another set, at line ", __LINE__, "\n"; |
235 | |
236 | my $p = Pod::Simple::PullParser->new; |
237 | $p->set_source( \qq{\n=head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
238 | |
239 | ok $p->get_title() || '', ''; |
240 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
241 | my $t; |
242 | |
243 | ok( $t = $p->get_token); |
244 | ok( $t && $t->type, 'start'); |
245 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
246 | |
247 | } |
248 | ########################################################################### |
249 | |
250 | { |
251 | print "# Testing another set, at line ", __LINE__, "\n"; |
252 | |
253 | my $p = Pod::Simple::PullParser->new; |
254 | $p->set_source( \qq{\n=head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
255 | |
256 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
257 | ok $p->get_title() || '', ''; |
258 | my $t; |
259 | |
260 | ok( $t = $p->get_token); |
261 | ok( $t && $t->type, 'start'); |
262 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
263 | |
264 | } |
265 | |
266 | ########################################################################### |
267 | |
268 | { |
269 | print "# Testing another set, at line ", __LINE__, "\n"; |
270 | |
271 | my $p = Pod::Simple::PullParser->new; |
272 | $p->set_source( \qq{\n=head1 NAME\n\nThingy\n\n=head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
273 | |
274 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
275 | ok $p->get_title(), "Thingy"; |
276 | my $t; |
277 | |
278 | ok( $t = $p->get_token); |
279 | ok( $t && $t->type, 'start'); |
280 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
281 | |
282 | } |
283 | |
284 | ########################################################################### |
285 | |
286 | { |
287 | print "# Testing another set, at line ", __LINE__, "\n"; |
288 | |
289 | my $p = Pod::Simple::PullParser->new; |
290 | $p->set_source( \qq{\n=head1 NAME\n\nThingy\n\n=head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
291 | |
292 | ok $p->get_title(), "Thingy"; |
293 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
294 | my $t; |
295 | |
296 | ok( $t = $p->get_token); |
297 | ok( $t && $t->type, 'start'); |
298 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
299 | |
300 | } |
301 | |
302 | ########################################################################### |
303 | |
304 | { |
305 | print "# Testing another set, at line ", __LINE__, "\n"; |
306 | |
307 | my $p = Pod::Simple::PullParser->new; |
308 | $p->set_source( \qq{\n=head1 (NAME) ÷ÄÁÌÉ ÐÅÒÅÄ\n\nThingy\n\n=head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ\n\nëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); |
309 | |
310 | ok $p->get_title(), "Thingy"; |
311 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
312 | my $t; |
313 | |
314 | ok( $t = $p->get_token); |
315 | ok( $t && $t->type, 'start'); |
316 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
317 | |
318 | } |
319 | |
320 | ########################################################################### |
321 | |
322 | { |
323 | print "# Testing another set, at line ", __LINE__, "\n"; |
324 | |
325 | my $p = Pod::Simple::PullParser->new; |
326 | $p->set_source( \q{ |
327 | |
328 | =head1 (NAME) ÷ÄÁÌÉ ÐÅÒÅÄ |
329 | |
330 | Thingy |
331 | |
332 | =head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ |
333 | |
334 | ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading |
335 | |
336 | =pod |
337 | |
338 | Grunk |
339 | |
340 | =cut |
341 | } ); |
342 | |
343 | ok $p->get_title(), "Thingy"; |
344 | ok $p->get_version() || '', ''; |
345 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
346 | my $t; |
347 | |
348 | ok( $t = $p->get_token); |
349 | ok( $t && $t->type, 'start'); |
350 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
351 | |
352 | } |
353 | |
354 | ########################################################################### |
355 | |
356 | { |
357 | print "# Testing another set, at line ", __LINE__, "\n"; |
358 | |
359 | my $p = Pod::Simple::PullParser->new; |
360 | $p->set_source( \q{ |
361 | |
362 | =head1 (NAME) ÷ÄÁÌÉ ÐÅÒÅÄ |
363 | |
364 | Thingy |
365 | |
366 | =head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ |
367 | |
368 | ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading |
369 | |
370 | =head1 VERSION |
371 | |
372 | Stuff: Thing |
373 | Whatever: Um. |
374 | |
375 | =head1 AUTHOR |
376 | |
377 | Jojoj E<65>arzarz |
378 | |
379 | =pod |
380 | |
381 | Grunk |
382 | |
383 | =cut |
384 | } ); |
385 | |
386 | ok $p->get_title(), "Thingy"; |
387 | my $v = $p->get_version || ''; |
388 | $v =~ s/^ +//m; |
389 | $v =~ s/^\s+//s; |
390 | $v =~ s/\s+$//s; |
391 | ok $v, "Stuff: Thing\nWhatever: Um."; |
392 | ok $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading}; |
393 | ok $p->get_author() || '', 'Jojoj Aarzarz'; |
394 | |
395 | |
396 | my $t; |
397 | ok( $t = $p->get_token); |
398 | ok( $t && $t->type, 'start'); |
399 | ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); |
400 | |
401 | } |
402 | |
403 | ########################################################################### |
404 | ########################################################################### |
405 | |
406 | |
407 | print "# Wrapping up... one for the road...\n"; |
408 | ok 1; |
409 | print "# --- Done with ", __FILE__, " --- \n"; |
410 | |
411 | __END__ |
412 | |