This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #35865, #43011] FETCH after autovivifying
[perl5.git] / t / op / utftaint.t
index 1294526..df99c8d 100644 (file)
@@ -23,10 +23,7 @@ plan(tests => 3*10 + 3*8 + 2*16 + 2);
 my $arg = $ENV{PATH}; # a tainted value
 use constant UTF8 => "\x{1234}";
 
-sub is_utf8 {
-    my $s = shift;
-    return 0xB6 != unpack('C', chr(0xB6).$s);
-}
+*is_utf8 = \&utf8::is_utf8;
 
 for my $ary ([ascii => 'perl'], [latin1 => "\xB6"], [utf8 => "\x{100}"]) {
     my $encode = $ary->[0];
@@ -143,10 +140,12 @@ for my $ary ([ascii => 'perl'], [latin1 => "\xB6"]) {
     is(tainted($taint), tainted($arg), "tainted: $encode, downgrade down");
 }
 
-fresh_perl_is('$a = substr $^X, 0, 0; /\x{100}/i; /$a\x{100}/i || print q,ok,',
-             'ok', {switches => ["-T", "-l"]},
-             "matching a regexp is taint agnostic");
+{
+    fresh_perl_is('$a = substr $^X, 0, 0; /\x{100}/i; /$a\x{100}/i || print q,ok,',
+                 'ok', {switches => ["-T", "-l"]},
+                 "matching a regexp is taint agnostic");
 
-fresh_perl_is('$a = substr $^X, 0, 0; /$a\x{100}/i || print q,ok,',
-             'ok', {switches => ["-T", "-l"]},
-             "therefore swash_init should be taint agnostic");
+    fresh_perl_is('$a = substr $^X, 0, 0; /$a\x{100}/i || print q,ok,',
+                 'ok', {switches => ["-T", "-l"]},
+                 "therefore swash_init should be taint agnostic");
+}