This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/t/utf8_warn_base.pl: Create block for warnings control
authorKarl Williamson <khw@cpan.org>
Mon, 19 Jun 2017 04:25:39 +0000 (22:25 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 13 Jul 2017 03:14:25 +0000 (21:14 -0600)
This adds a block that turns off warnings in the whole thing, so that
tests can be more easily be modified in future commits, and the interior
warnings control statments can be removed.

ext/XS-APItest/t/utf8_warn_base.pl

index 239cb89..83ca99e 100644 (file)
@@ -29,7 +29,10 @@ use warnings 'utf8';
 local $SIG{__WARN__} = sub { my @copy = @_;
                              push @warnings_gotten, map { chomp; $_ } @copy;
                            };
-my @tests = (
+my @tests;
+{
+    no warnings qw(portable overflow);
+    @tests = (
         # $testname,
         # $bytes,                  UTF-8 string
         # $allowed_uv,             code point $bytes evaluates to; -1 if
@@ -318,7 +321,6 @@ my @tests = (
 
     if (! $::is64bit) {
         if (isASCII) {
-            no warnings qw{portable overflow};
             push @tests,
                 [ "Lowest 33 bit code point: overflow",
                     "\xFE\x84\x80\x80\x80\x80\x80",
@@ -328,7 +330,6 @@ my @tests = (
         }
     }
     else {
-        no warnings qw{portable overflow};
         push @tests,
             [ "More than 32 bits",
                 (isASCII)
@@ -379,6 +380,7 @@ my @tests = (
                 ];
         }
     }
+}
 
 sub flags_to_text($$)
 {