utf8.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl
BEGIN {
chdir 't' if -d 't';
print "1..0 # Skip: not perlio\n";
exit 0;
}
}
require "./test.pl";
$| = 1;
print F "\n";
seek(F,0,0);
seek(F,0,0);
seek(F,0,0);
seek(F,0,0);
close(F);
{
print F $a,"\n";
close F;
$x = <F>;
$x = <F>;
close F;
print F $a;
my $y;
}
{ # Check byte length of $b
}
print F $b,"\n"; # Don't upgrades $b
{ # Check byte length of $b
}
{
}
close F;
$x = <F>;
chomp($x);
$x = <F>;
chomp($x);
close F;
}
# Now let's make it suffer.
my $w;
{
print F $a;
}
}
# Hm. Time to get more evil.
print F $a;
close F;
$x = <F>; chomp $x;
# Right.
print F $a;
close F;
close F;
$x = <F>; chomp $x;
# Now we have a deformed file.
SKIP: {
} else {
$x = <F>; chomp $x;
}
}
close F;
print F @a;
close F;
my $c;
# read() should work on characters, not bytes
$a = 0;
for (@a) {
print '# $a == ', $a, "\n";
print '# $c == ', $c, "\n";
print "not ";
last;
}
}
close F;
{
# Check that warnings are on on I/O, and that they can be muffled.
undef $@;
undef $@;
undef $@;
undef $@;
undef $@;
}
{
my $b = chr 0x100;
$b .= <F>;
close F;
}
{
my $b = "\xde";
$b .= <F>;
close F;
}
{
my @a = ( [ 0x007F, "bytes" ],
[ 0x0080, "bytes" ],
[ 0x0080, "utf8" ],
[ 0x0100, "utf8" ] );
my $t = 34;
for my $u (@a) {
for my $v (@a) {
# print "# @$u - @$v\n";
close F;
$s .= <F>;
close F;
$t++;
}
}
# last test here 49
}
{
# [perl #23428] Somethings rotten in unicode semantics
close F;
}
{
# <FH> on a :utf8 stream should complain immediately with -w
# if it finds bad UTF-8 (:encoding(utf8) works this way)
undef $@;
binmode F;
close F;
undef $@;
my $line = <F>;
"<:utf8 readline must warn about bad utf8");
undef $@;
$line .= <F>;
"<:utf8 rcatline must warn about bad utf8");
close F;
}
END {
}