diff --git a/lib/PPI/Token/Pod.pm b/lib/PPI/Token/Pod.pm index 5aac876d..6e21a326 100644 --- a/lib/PPI/Token/Pod.pm +++ b/lib/PPI/Token/Pod.pm @@ -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; diff --git a/t/ppi_token_pod.t b/t/ppi_token_pod.t index fc42cc36..ff1e225f 100644 --- a/t/ppi_token_pod.t +++ b/t/ppi_token_pod.t @@ -12,7 +12,7 @@ BEGIN { } use PPI; -use Test::More tests => 4; +use Test::More tests => 8; { # Create the test fragments @@ -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;