X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/f4d859337868ec181836a6acbefc3c764993b80f..refs/heads/b-3.4.1:/t/structure/no_lexicals_in_postif.t diff --git a/t/structure/no_lexicals_in_postif.t b/t/structure/no_lexicals_in_postif.t index bb15c9cc9..3f906937f 100644 --- a/t/structure/no_lexicals_in_postif.t +++ b/t/structure/no_lexicals_in_postif.t @@ -24,10 +24,24 @@ my $fh; my @testitems = @Support::Files::testitems; foreach my $file (@testitems) { - next unless -f $file; my $clean = 1; - my $doc = PPI::Document->new($file) or do { - ok 0, "PPI error for file $file: " . PPI::Document::errstr(); + my $source; + { + # due to a bug in PPI it cannot determine the encoding of a source file by + # use utf8; normaly this would be no problem but some people instist on + # putting strange stuff into the source. as a workaround read in the source + # with :utf8 layer and pass it to PPI by reference + # there are still some latin chars, but it's not the purpose of this test + # to find them, so warnings about it will be ignored + local $^W = 0; # don't care about invalid chars in comments + local $/ = undef; + open my $fh, '<:utf8', $file or die $!; + $source = <$fh>; + } + + my $doc = PPI::Document->new(\$source) or do { + print $fh "?: PPI error for file $file: " . PPI::Document::errstr() . "\n"; + ok 0, $file; next; }; my $stmts = $doc->find('Statement::Variable');