Skip to content

Commit

Permalink
RT 75039: don't allow '=CUT' to terminate POD
Browse files Browse the repository at this point in the history
  • Loading branch information
moregan authored and wchristian committed Jan 29, 2014
1 parent 324b993 commit 1bdce9b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/PPI/Token/Pod.pm
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ sub __TOKENIZER__on_line_start {
# Check the line to see if it is a =cut line
if ( $t->{line} =~ /^=(\w+)/ ) {
# End of the token
$t->_finalize_token if lc $1 eq 'cut';
$t->_finalize_token if $1 eq 'cut';
}

0;
Expand Down
16 changes: 15 additions & 1 deletion t/ppi_token_pod.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BEGIN {
}
use PPI;

use Test::More tests => 4;
use Test::More tests => 8;

{
# Create the test fragments
Expand All @@ -28,4 +28,18 @@ use Test::More tests => 4;
}


{
foreach my $test (
[ "=pod\n=cut", [ 'PPI::Token::Pod' ] ],
[ "=pod\n=cut\n", [ 'PPI::Token::Pod' ] ],
[ "=pod\n=cut\n\n", [ 'PPI::Token::Pod', 'PPI::Token::Whitespace' ] ],
[ "=pod\n=Cut\n\n", [ 'PPI::Token::Pod' ] ], # pod doesn't end, so no whitespace token
) {
my $T = PPI::Tokenizer->new( \$test->[0] );
my @tokens = map { ref $_ } @{ $T->all_tokens };
is_deeply( \@tokens, $test->[1], 'all tokens as expected' );
}
}


1;

0 comments on commit 1bdce9b

Please sign in to comment.