3 use Test::More tests => 115;
5 #use Pod::Simple::Debug (5);
7 #sub Pod::Simple::MANY_LINES () {1}
8 #sub Pod::Simple::PullParser::DEBUG () {3}
11 use Pod::Simple::PullParser;
13 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 ###########################################################################
17 print "# Testing another set, at line ", __LINE__, "\n";
19 my $p = Pod::Simple::PullParser->new;
20 $p->set_source( \qq{\n=head1 NAME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} );
22 ok $p->get_title(), 'Bzorch';
26 ok( $t = $p->get_token);
27 is( $t && $t->type, 'start');
28 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
30 ok( $t = $p->get_token);
31 is( $t && $t->type, 'start');
32 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
34 ok( $t = $p->get_token);
35 is( $t && $t->type, 'text');
36 is( $t && $t->type eq 'text' && $t->text, 'NAME' );
41 eval { $p->set_source(\'=head1 foo') };
43 like $@, qr/\QCannot assign new source to pull parser; create a new instance, instead/;
47 ###########################################################################
50 print "# Testing a set with nocase, at line ", __LINE__, "\n";
51 my $p = Pod::Simple::PullParser->new;
52 $p->set_source( \qq{\n=head1 Name\n\nShazbot\n\n=pod\n\nLala\n\n\=cut\n} );
54 ok $p->get_title(nocase => 1), 'Shazbot';
56 ok( my $t = $p->get_token);
57 is( $t && $t->type, 'start');
58 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
60 ok( $t = $p->get_token);
61 is( $t && $t->type, 'start');
62 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
64 ok( $t = $p->get_token);
65 is( $t && $t->type, 'text');
66 is( $t && $t->type eq 'text' && $t->text, 'Name' );
70 ###########################################################################
73 print "# Testing another set, at line ", __LINE__, "\n";
75 my $p = Pod::Simple::PullParser->new;
76 $p->set_source( \qq{\n=head1 NE<65>ME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} );
78 ok $p->get_title(), 'Bzorch';
81 ok( $t = $p->get_token);
82 is( $t && $t->type, 'start');
83 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
85 ok( $t = $p->get_token);
86 is( $t && $t->type, 'start');
87 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
89 ok( $t = $p->get_token);
90 is( $t && $t->type, 'text');
95 ###########################################################################
98 print "# Testing another set, at line ", __LINE__, "\n";
101 my $p = Pod::Simple::PullParser->new;
102 $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} );
103 is $p->get_title(), 'Bzorch - thing lala';
107 my $p = Pod::Simple::PullParser->new;
108 $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} );
109 is $p->get_title(), 'Bzorch - thing lala';
113 ok( $t = $p->get_token);
114 is( $t && $t->type, 'start');
115 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
117 ok( $t = $p->get_token);
118 is( $t && $t->type, 'start');
119 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
121 ok( $t = $p->get_token);
122 is( $t && $t->type, 'text');
123 is( $t && $t->type eq 'text' && $t->text, 'NAME' );
127 ###########################################################################
130 print "# Testing another set, at line ", __LINE__, "\n";
132 my $p = Pod::Simple::PullParser->new;
133 $p->set_source( \qq{\n=head1 Bzorch lala\n\n=pod\n\nLala\n\n\=cut\n} );
135 is $p->get_title(), 'Bzorch lala';
138 ok( $t = $p->get_token);
139 is( $t && $t->type, 'start');
140 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
142 ok( $t = $p->get_token);
143 is( $t && $t->type, 'start');
144 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
146 ok( $t = $p->get_token);
147 is( $t && $t->type, 'text');
148 is( $t && $t->type eq 'text' && $t->text, 'Bzorch lala' );
152 ###########################################################################
155 print "# Testing another set, at line ", __LINE__, "\n";
157 my $p = Pod::Simple::PullParser->new;
158 $p->set_source( \qq{\n=head1 Bzorch - I<thing> lala\n\n=pod\n\nLala\n\n\=cut\n} );
160 is $p->get_title(), 'Bzorch - thing lala';
163 ok( $t = $p->get_token);
164 is( $t && $t->type, 'start');
165 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
167 ok( $t = $p->get_token);
168 is( $t && $t->type, 'start');
169 is( $t && $t->type eq 'start' && $t->tagname, 'head1' );
171 ok( $t = $p->get_token);
172 is( $t && $t->type, 'text');
173 is( $t && $t->type eq 'text' && $t->text, 'Bzorch - ' );
176 ###########################################################################
179 print "# Testing another set, at line ", __LINE__, "\n";
181 my $p = Pod::Simple::PullParser->new;
182 $p->set_source( \qq{\n=head1 Nombre (NAME)\n\nBzorch - I<thing> lala\n\n=pod\n\nGrunk\n\n\=cut\n} );
184 is $p->get_version || '', '';
185 is $p->get_author || '', '';
187 ok $p->get_title(), 'Bzorch - thing lala';
190 ok( $t = $p->get_token);
191 ok( $t && $t->type, 'start');
192 ok( $t && $t->type eq 'start' && $t->tagname, 'Document' );
195 ###########################################################################
198 print "# Testing another set, at line ", __LINE__, "\n";
200 my $p = Pod::Simple::PullParser->new;
201 $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} );
203 ok $p->get_title(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
206 ok( $t = $p->get_token);
207 is( $t && $t->type, 'start');
208 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
212 ###########################################################################
215 print "# Testing another set, at line ", __LINE__, "\n";
217 my $p = Pod::Simple::PullParser->new;
218 $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} );
220 is $p->get_title(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
223 ok( $t = $p->get_token);
224 is( $t && $t->type, 'start');
225 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
229 ###########################################################################
232 print "# Testing another set, at line ", __LINE__, "\n";
234 my $p = Pod::Simple::PullParser->new;
235 $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} );
237 is $p->get_title() || '', '';
238 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
241 ok( $t = $p->get_token);
242 is( $t && $t->type, 'start');
243 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
246 ###########################################################################
249 print "# Testing another set, at line ", __LINE__, "\n";
251 my $p = Pod::Simple::PullParser->new;
252 $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} );
254 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
255 is $p->get_title() || '', '';
258 ok( $t = $p->get_token);
259 is( $t && $t->type, 'start');
260 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
264 ###########################################################################
267 print "# Testing another set, at line ", __LINE__, "\n";
269 my $p = Pod::Simple::PullParser->new;
270 $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} );
272 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
273 is $p->get_title(), "Thingy";
276 ok( $t = $p->get_token);
277 is( $t && $t->type, 'start');
278 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
282 ###########################################################################
285 print "# Testing another set, at line ", __LINE__, "\n";
287 my $p = Pod::Simple::PullParser->new;
288 $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} );
290 is $p->get_title(), "Thingy";
291 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
294 ok( $t = $p->get_token);
295 is( $t && $t->type, 'start');
296 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
300 ###########################################################################
303 print "# Testing another set, at line ", __LINE__, "\n";
305 my $p = Pod::Simple::PullParser->new;
306 $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} );
308 is $p->get_title(), "Thingy";
309 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
312 ok( $t = $p->get_token);
313 is( $t && $t->type, 'start');
314 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
318 ###########################################################################
321 print "# Testing another set, at line ", __LINE__, "\n";
323 my $p = Pod::Simple::PullParser->new;
326 =head1 (NAME) ÷ÄÁÌÉ ÐÅÒÅÄ
330 =head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ
332 ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading
341 is $p->get_title(), "Thingy";
342 is $p->get_version() || '', '';
343 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
346 ok( $t = $p->get_token);
347 is( $t && $t->type, 'start');
348 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
352 ###########################################################################
355 print "# Testing another set, at line ", __LINE__, "\n";
357 my $p = Pod::Simple::PullParser->new;
360 =head1 (NAME) ÷ÄÁÌÉ ÐÅÒÅÄ
364 =head1 (DESCRIPTION) ëÏÇÄÁ ÞÉÔÁÌÁ
366 ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's I<"When you were> reading
384 is $p->get_title(), "Thingy";
385 my $v = $p->get_version || '';
389 is $v, "Stuff: Thing\nWhatever: Um.";
390 is $p->get_description(), q{ëÏÇÄÁ ÞÉÔÁÌÁ ÔÙ ÍÕÞÉÔÅÌØÎÙÅ ÓÔÒÏËÉ -- Fet's "When you were reading};
391 is $p->get_author() || '', 'Jojoj Aarzarz';
395 ok( $t = $p->get_token);
396 is( $t && $t->type, 'start');
397 is( $t && $t->type eq 'start' && $t->tagname, 'Document' );
401 ###########################################################################
403 print "# Testing a title with an X<>, at line ", __LINE__, "\n";
404 my $p = Pod::Simple::PullParser->new;
405 $p->set_source( \qq{\n=head1 NAME Foo Bar\nX<Some entry>\n} );
407 is $p->get_title(), 'NAME Foo Bar';