@INC = '../lib';
require './test.pl';
- plan(tests => 91);
+ plan(tests => 97);
}
use strict;
is($hashu{"\x7f"},0x7F);
# Now try same thing with variables forced into various forms.
-foreach my $a ("\x7f","\xff")
+foreach ("\x7f","\xff")
{
+ my $a = $_; # Force a copy
utf8::upgrade($a);
is($hash8{$a},ord($a));
is($hashu{$a},ord($a));
# Check we have not got an spurious extra keys
is(join('',sort { ord $a <=> ord $b } keys %hash8),"\x7f\xff\x{1ff}");
-foreach my $a ("\x7f","\xff","\x{1ff}")
+foreach ("\x7f","\xff","\x{1ff}")
{
+ my $a = $_;
utf8::upgrade($a);
is($hash8{$a},ord($a));
my $b = $a.chr(100);
is(delete $hashu{chr(0x1ff)},0x1ff);
is(join('',sort keys %hashu),"\x7f\xff");
-foreach my $a ("\x7f","\xff")
+foreach ("\x7f","\xff")
{
+ my $a = $_;
utf8::upgrade($a);
is($hashu{$a},ord($a));
utf8::downgrade($a);
}
}
+
+{
+ # See if utf8 barewords work [perl #22969]
+ use utf8;
+ my %hash = (тест => 123);
+ is($hash{тест}, $hash{'тест'});
+ is($hash{тест}, 123);
+ is($hash{'тест'}, 123);
+ %hash = (тест => 123);
+ is($hash{тест}, $hash{'тест'});
+ is($hash{тест}, 123);
+ is($hash{'тест'}, 123);
+}