This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/t/utf8_warn_base.pl: Skip inappropriate tests
authorKarl Williamson <khw@cpan.org>
Wed, 5 Jul 2017 19:00:03 +0000 (13:00 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 13 Jul 2017 03:14:25 +0000 (21:14 -0600)
If we don't have enough information for the test to be meaningful, don't
bother doing it.

ext/XS-APItest/t/utf8_warn_base.pl

index aa9dabf..7a13c2f 100644 (file)
@@ -1010,6 +1010,13 @@ foreach my $test (@tests) {
                                                     if $malformed_allow_type;
             }
 
+            # The whole point of a test that is malformed from the beginning
+            # is to test for that malformation.  If we've modified things so
+            # much that we don't have enough information to detect that
+            # malformation, there's no point in testing.
+            next if    $initially_malformed
+                    && $this_expected_len < $this_needed_to_discern_len;
+
             # Here, we've transformed the input with all of the desired
             # non-overflow malformations.  We are now in a position to
             # construct any potential warnings for those malformations.  But