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