diff options
author | David Mitchell <davem@iabyn.com> | 2015-06-19 12:47:05 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2015-06-19 12:47:05 +0100 |
commit | 33c28ab263ac8bba71954d61ec55d7f1dc6c0eca (patch) | |
tree | 96f97216db61bab1ff879fb662e18d1c64db471d /t | |
parent | 9558026484c47d197ababb92c9e5477b379f7c42 (diff) | |
download | perl-33c28ab263ac8bba71954d61ec55d7f1dc6c0eca.tar.gz |
remove deprecated /\C/ RE character class
This horrible thing broke encapsulation and was as buggy as a very buggy
thing. It's been officially deprecated since 5.20.0 and now it can finally
die die die!!!!
Diffstat (limited to 't')
-rw-r--r-- | t/lib/Cname.pm | 10 | ||||
-rw-r--r-- | t/op/bop.t | 36 | ||||
-rw-r--r-- | t/re/pat_advanced.t | 83 | ||||
-rw-r--r-- | t/re/pat_rt_report.t | 69 |
4 files changed, 2 insertions, 196 deletions
diff --git a/t/lib/Cname.pm b/t/lib/Cname.pm index 4a1bc16d85..dad356ae66 100644 --- a/t/lib/Cname.pm +++ b/t/lib/Cname.pm @@ -24,16 +24,6 @@ sub translator { if ( $str eq 'TOO-LONG-STR') { return 'A' x 256; } - if ($str eq 'MALFORMED') { - $str = "\xDF\xDFabc"; - utf8::upgrade($str); - - no warnings 'deprecated'; - - # Create a malformed in first and second characters. - $str =~ s/^\C/A/; - $str =~ s/^(\C\C)\C/$1A/; - } return $str; } diff --git a/t/op/bop.t b/t/op/bop.t index 09f2be9ab9..8acd3b2afd 100644 --- a/t/op/bop.t +++ b/t/op/bop.t @@ -15,7 +15,7 @@ BEGIN { # If you find tests are failing, please try adding names to tests to track # down where the failure is, and supply your new names as a patch. # (Just-in-time test naming) -plan tests => 194 + (10*13*2) + 5; +plan tests => 192 + (10*13*2) + 5; # numerics ok ((0xdead & 0xbeef) == 0x9ead); @@ -430,40 +430,6 @@ SKIP: { is($b, chr(0x1FE) x 0x0FF . chr(0x101) x 2); } -# update to pp_complement() via Coverity -SKIP: { - # UTF-EBCDIC is limited to 0x7fffffff and can't encode ~0. - skip "Complements exceed maximum representable on EBCDIC ", 2 if $::IS_EBCDIC; - - my $str = "\x{10000}\x{800}"; - # U+10000 is four bytes in UTF-8/UTF-EBCDIC. - # U+0800 is three bytes in UTF-8/UTF-EBCDIC. - - no warnings "utf8"; - { - use bytes; - no warnings 'deprecated'; - $str =~ s/\C\C\z//; - } - - # it's really bogus that (~~malformed) is \0. - my $ref = "\x{10000}\0"; - is(~~$str, $ref); - - # same test, but this time with a longer replacement string that - # exercises a different branch in pp_subsr() - - $str = "\x{10000}\x{800}"; - { - use bytes; - no warnings 'deprecated'; - $str =~ s/\C\C\z/\0\0\0/; - } - - # it's also bogus that (~~malformed) is \0\0\0\0. - my $ref = "\x{10000}\0\0\0\0"; - is(~~$str, $ref, "use bytes with long replacement"); -} # New string- and number-specific bitwise ops { diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index 891bb66061..230fd891a6 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -28,57 +28,6 @@ run_tests() unless caller; sub run_tests { { - no warnings 'deprecated'; - - my $message = '\C matches octet'; - $_ = "a\x{100}b"; - ok(/(.)(\C)(\C)(.)/, $message); - is($1, "a", $message); - if ($::IS_ASCII) { # ASCII (or equivalent), should be UTF-8 - is($2, "\xC4", $message); - is($3, "\x80", $message); - } - elsif ($::IS_EBCDIC) { # EBCDIC (or equivalent), should be UTF-EBCDIC - is($2, "\x8C", $message); - is($3, "\x41", $message); - } - else { - SKIP: { - ok 0, "Unexpected platform", "ord ('A') =" . ord 'A'; - skip "Unexpected platform"; - } - } - is($4, "b", $message); - } - - { - no warnings 'deprecated'; - - my $message = '\C matches octet'; - $_ = "\x{100}"; - ok(/(\C)/g, $message); - if ($::IS_ASCII) { - is($1, "\xC4", $message); - } - elsif ($::IS_EBCDIC) { - is($1, "\x8C", $message); - } - else { - ok 0, "Unexpected platform", "ord ('A') = " . ord 'A'; - } - ok(/(\C)/g, $message); - if ($::IS_ASCII) { - is($1, "\x80", $message); - } - elsif ($::IS_EBCDIC) { - is($1, "\x41", $message); - } - else { - ok 0, "Unexpected platform", "ord ('A') = " . ord 'A'; - } - } - - { # Japhy -- added 03/03/2001 () = (my $str = "abc") =~ /(...)/; $str = "def"; @@ -284,24 +233,6 @@ sub run_tests { } { - no warnings 'deprecated'; - - my $message = '. matches \n with /s'; - my $str1 = "foo\nbar"; - my $str2 = "foo\n\x{100}bar"; - my ($a, $b) = map {chr} $::IS_ASCII ? (0xc4, 0x80) : (0x8c, 0x41); - my @a; - @a = $str1 =~ /./g; is(@a, 6, $message); is("@a", "f o o b a r", $message); - @a = $str1 =~ /./gs; is(@a, 7, $message); is("@a", "f o o \n b a r", $message); - @a = $str1 =~ /\C/g; is(@a, 7, $message); is("@a", "f o o \n b a r", $message); - @a = $str1 =~ /\C/gs; is(@a, 7, $message); is("@a", "f o o \n b a r", $message); - @a = $str2 =~ /./g; is(@a, 7, $message); is("@a", "f o o \x{100} b a r", $message); - @a = $str2 =~ /./gs; is(@a, 8, $message); is("@a", "f o o \n \x{100} b a r", $message); - @a = $str2 =~ /\C/g; is(@a, 9, $message); is("@a", "f o o \n $a $b b a r", $message); - @a = $str2 =~ /\C/gs; is(@a, 9, $message); is("@a", "f o o \n $a $b b a r", $message); - } - - { no warnings 'digit'; # Check that \x## works. 5.6.1 and 5.005_03 fail some of these. my $x; @@ -492,11 +423,6 @@ sub run_tests { =~ /^(\X)!/ && $1 eq "\N{LATIN CAPITAL LETTER E}\N{COMBINING GRAVE ACCENT}", $message); - no warnings 'deprecated'; - - $message = '\C and \X'; - like("!abc!", qr/a\Cc/, $message); - like("!abc!", qr/a\Xc/, $message); } { @@ -552,13 +478,6 @@ sub run_tests { $& eq "Francais", $message); ok("Fran\N{LATIN SMALL LETTER C WITH CEDILLA}ais" =~ /Fran.ais/ && $& eq "Fran\N{LATIN SMALL LETTER C WITH CEDILLA}ais", $message); - { - no warnings 'deprecated'; - ok("Fran\N{LATIN SMALL LETTER C}ais" =~ /Fran\Cais/ && - $& eq "Francais", $message); - # COMBINING CEDILLA is two bytes when encoded - like("Franc\N{COMBINING CEDILLA}ais", qr/Franc\C\Cais/, $message); - } ok("Fran\N{LATIN SMALL LETTER C}ais" =~ /Fran\Xais/ && $& eq "Francais", $message); ok("Fran\N{LATIN SMALL LETTER C WITH CEDILLA}ais" =~ /Fran\Xais/ && @@ -1114,8 +1033,6 @@ sub run_tests { # differently undef $w; eval q [ok "\N{TOO-LONG-STR}" =~ /^\N{TOO-LONG-STR}$/, 'Verify that what once was too long a string works']; - eval 'q(syntax error) =~ /\N{MALFORMED}/'; - ok $@ && $@ =~ /Malformed/, 'Verify that malformed utf8 gives an error'; eval 'q() =~ /\N{4F}/'; ok $@ && $@ =~ /Invalid character/, 'Verify that leading digit in name gives error'; eval 'q() =~ /\N{COM,MA}/'; diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t index ed8fafcc78..f35e72c35f 100644 --- a/t/re/pat_rt_report.t +++ b/t/re/pat_rt_report.t @@ -20,7 +20,7 @@ use warnings; use 5.010; use Config; -plan tests => 2532; # Update this when adding/deleting tests. +plan tests => 2500; # Update this when adding/deleting tests. run_tests() unless caller; @@ -89,13 +89,6 @@ sub run_tests { } { - no warnings 'deprecated'; - my $message = '\C and É; Bug 20001230.002'; - ok("École" =~ /^\C\C(.)/ && $1 eq 'c', $message); - like("École", qr/^\C\C(c)/, $message); - } - - { # The original bug report had 'no utf8' here but that was irrelevant. my $message = "Don't dump core; Bug 20010306.008"; @@ -233,59 +226,6 @@ sub run_tests { } { - our $a = "x\x{100}"; - chop $a; # Leaves the UTF-8 flag - $a .= "y"; # 1 byte before 'y'. - - no warnings 'deprecated'; - - like($a, qr/^\C/, 'match one \C on 1-byte UTF-8; Bug 15763'); - like($a, qr/^\C{1}/, 'match \C{1}; Bug 15763'); - - like($a, qr/^\Cy/, 'match \Cy; Bug 15763'); - like($a, qr/^\C{1}y/, 'match \C{1}y; Bug 15763'); - - unlike($a, qr/^\C\Cy/, q {don't match two \Cy; Bug 15763}); - unlike($a, qr/^\C{2}y/, q {don't match \C{2}y; Bug 15763}); - - $a = "\x{100}y"; # 2 bytes before "y" - - like($a, qr/^\C/, 'match one \C on 2-byte UTF-8; Bug 15763'); - like($a, qr/^\C{1}/, 'match \C{1}; Bug 15763'); - like($a, qr/^\C\C/, 'match two \C; Bug 15763'); - like($a, qr/^\C{2}/, 'match \C{2}; Bug 15763'); - - like($a, qr/^\C\C\C/, 'match three \C on 2-byte UTF-8 and a byte; Bug 15763'); - like($a, qr/^\C{3}/, 'match \C{3}; Bug 15763'); - - like($a, qr/^\C\Cy/, 'match two \C; Bug 15763'); - like($a, qr/^\C{2}y/, 'match \C{2}; Bug 15763'); - - unlike($a, qr/^\C\C\Cy/, q {don't match three \Cy; Bug 15763}); - unlike($a, qr/^\C{2}\Cy/, q {don't match \C{2}\Cy; Bug 15763}); - unlike($a, qr/^\C{3}y/, q {don't match \C{3}y; Bug 15763}); - - $a = "\x{1000}y"; # 3 bytes before "y" - - like($a, qr/^\C/, 'match one \C on three-byte UTF-8; Bug 15763'); - like($a, qr/^\C{1}/, 'match \C{1}; Bug 15763'); - like($a, qr/^\C\C/, 'match two \C; Bug 15763'); - like($a, qr/^\C{2}/, 'match \C{2}; Bug 15763'); - like($a, qr/^\C\C\C/, 'match three \C; Bug 15763'); - like($a, qr/^\C{3}/, 'match \C{3}; Bug 15763'); - - like($a, qr/^\C\C\C\C/, 'match four \C on three-byte UTF-8 and a byte; Bug 15763'); - like($a, qr/^\C{4}/, 'match \C{4}; Bug 15763'); - - like($a, qr/^\C\C\Cy/, 'match three \Cy; Bug 15763'); - like($a, qr/^\C{3}y/, 'match \C{3}y; Bug 15763'); - - unlike($a, qr/^\C\C\C\Cy/, q {don't match four \Cy; Bug 15763}); - unlike($a, qr/^\C{4}y/, q {don't match \C{4}y; Bug 15763}); - } - - - { my $message = 'UTF-8 matching; Bug 15397'; like("\x{100}", qr/\x{100}/, $message); like("\x{100}", qr/(\x{100})/, $message); @@ -1173,13 +1113,6 @@ EOP # in the report above that only happened in a thread. my $s = "\x{1ff}" . "f" x 32; ok($s =~ /\x{1ff}[[:alpha:]]+/gca, "POSIXA pointer wrap"); - - # this one segfaulted under the conditions above - # of course, CANY is evil, maybe it should crash - { - no warnings 'deprecated'; - ok($s =~ /.\C+/, "CANY pointer wrap"); - } } } # End of sub run_tests |