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