Skip to content

Commit

Permalink
Merge pull request #101 from pali/master
Browse files Browse the repository at this point in the history
Fixes for older perl versions
  • Loading branch information
dankogai authored May 17, 2017
2 parents d42e1f1 + 9139ec5 commit e52dd56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
24 changes: 14 additions & 10 deletions t/truncated_utf8.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@ is(decode("UTF-8", "\xc1\x9f"), "\x{fffd}");
is(decode("UTF-8", "\xFF\x80\x90\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80"), "\x{fffd}");
is(decode("UTF-8", "\xF0\x80\x80\x80"), "\x{fffd}");

my $str = ("x" x 1023) . "\xfd\xfe\xffx";
open my $fh, '<:encoding(UTF-8)', \$str;
my $str2 = <$fh>;
close $fh;
is($str2, ("x" x 1023) . ("\x{fffd}" x 3) . "x");

TODO: {
local $TODO = "bug in perlio";
my $str = ("x" x 1023) . "\xfd\xfe\xff";
SKIP: {
# infinite loop due to bug: https://rt.perl.org/Public/Bug/Display.html?id=41442
skip "Perl Version ($]) is older than v5.8.9", 2 if $] < 5.008009;
my $str = ("x" x 1023) . "\xfd\xfe\xffx";
open my $fh, '<:encoding(UTF-8)', \$str;
my $str2 = <$fh>;
close $fh;
is($str2, ("x" x 1023) . ("\x{fffd}" x 3));
is($str2, ("x" x 1023) . ("\x{fffd}" x 3) . "x");

TODO: {
local $TODO = "bug in perlio";
my $str = ("x" x 1023) . "\xfd\xfe\xff";
open my $fh, '<:encoding(UTF-8)', \$str;
my $str2 = <$fh>;
close $fh;
is($str2, ("x" x 1023) . ("\x{fffd}" x 3));
}
}
1 change: 1 addition & 0 deletions t/utf8messages.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use strict;
use warnings;
BEGIN { 'warnings'->unimport('utf8') if $] < 5.014 }; # turn off 'UTF-16 surrogate 0xd800' warnings

use Test::More;
use Encode qw(encode decode FB_CROAK LEAVE_SRC);
Expand Down

0 comments on commit e52dd56

Please sign in to comment.