diff options
author | Karl Williamson <khw@cpan.org> | 2016-10-08 20:53:31 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-10-13 11:18:12 -0600 |
commit | 1b514755b0094d7e6aff514fe66e91dc20eb5068 (patch) | |
tree | 0fd7db97bebdf98f7c1ccdb4ecd6fa994c9e7f49 | |
parent | ef652b2e6f462d1affda9b4fceb9f412473e128e (diff) | |
download | perl-1b514755b0094d7e6aff514fe66e91dc20eb5068.tar.gz |
APItest/t/utf8.t: Fix improper tests
These two tests are overlong malformations, besides being the ones
purportedly being tested. Make them not overlong, so are testing just
one thing
-rw-r--r-- | ext/XS-APItest/t/utf8.t | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/XS-APItest/t/utf8.t b/ext/XS-APItest/t/utf8.t index c6d78bf27b..5bb8bdee19 100644 --- a/ext/XS-APItest/t/utf8.t +++ b/ext/XS-APItest/t/utf8.t @@ -994,12 +994,12 @@ my @malformations = ( qr/unexpected non-continuation byte.*immediately after start byte/ ], [ "premature next character malformation (non-immediate)", - I8_to_native("\xf0${I8c}a"), + I8_to_native("\xf1${I8c}a"), 3, $UTF8_ALLOW_NON_CONTINUATION, $REPLACEMENT, 2, qr/unexpected non-continuation byte .* 2 bytes after start byte/ ], - [ "too short malformation", I8_to_native("\xf0${I8c}a"), 2, + [ "too short malformation", I8_to_native("\xf1${I8c}a"), 2, # Having the 'a' after this, but saying there are only 2 bytes also # tests that we pay attention to the passed in length $UTF8_ALLOW_SHORT, $REPLACEMENT, 2, @@ -1244,9 +1244,15 @@ foreach my $test (@malformations) { $ret = test_is_utf8_valid_partial_char_flags($bytes, $j, 0); my $ret_should_be = 0; my $comment = ""; - if ($testname =~ /premature|short/ && $j < 2) { - $ret_should_be = 1; - $comment = ", but need 2 bytes to discern:"; + if ($testname =~ /premature|short/ && $j < 3) { + + # The tests are hard-coded so these relationships hold + my $cut_off = 2; + $cut_off = 3 if $testname =~ /non-immediate/; + if ($j < $cut_off) { + $ret_should_be = 1; + $comment = ", but need $cut_off bytes to discern:"; + } } elsif ($testname =~ /overlong/ && ! isASCII && $length == 3) { # 3-byte overlongs on EBCDIC are determinable on the first byte |