diff options
author | Brian Fraser <fraserbn@gmail.com> | 2011-07-06 04:31:08 -0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:01:06 -0700 |
commit | 499321d39221df050fd12158b300e0d5f2c83941 (patch) | |
tree | 0f6b5096e1e0e58b08e5184df9b060d10f8cc30b /ext/XS-APItest | |
parent | 772d5078e19623501bc9e2e30401b270f2b64bcc (diff) | |
download | perl-499321d39221df050fd12158b300e0d5f2c83941.tar.gz |
gv.c: gv_fetchmeth_pvn_autoload UTF8 cleanup.
As with the previous commit, no Perl-level visible changes.
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r-- | ext/XS-APItest/t/gv_fetchmeth_autoload.t | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/ext/XS-APItest/t/gv_fetchmeth_autoload.t b/ext/XS-APItest/t/gv_fetchmeth_autoload.t index 2ceda8b18b..a24c00083c 100644 --- a/ext/XS-APItest/t/gv_fetchmeth_autoload.t +++ b/ext/XS-APItest/t/gv_fetchmeth_autoload.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 35; +use Test::More tests => 53; use_ok('XS::APItest'); @@ -47,3 +47,36 @@ ok !XS::APItest::gv_fetchmeth_autoload_type(\%::, "method\0not quite!", 1, $leve is XS::APItest::gv_fetchmeth_autoload_type(\%::, "method\0not quite!", 2, $level, 0), "*main::method", "gv_fetchmeth_autoload_pv() is not nul-clean"; ok !XS::APItest::gv_fetchmeth_autoload_type(\%::, "method\0not quite!", 3, $level, 0), "gv_fetchmeth_autoload_pvn() is nul-clean"; +{ + use utf8; + use open qw( :utf8 :std ); + + package main; + + sub method { 1 } + + my $meth_as_octets = + "\357\275\215\357\275\205\357\275\224\357\275\210\357\275\217\357\275\204"; + + $level = -1; + for my $type ( 1..3 ) { + ::is XS::APItest::gv_fetchmeth_autoload_type(\%main::, "method", $type, $level, 0), "*main::method", "$types[$type] is UTF-8 clean"; + ::ok !XS::APItest::gv_fetchmeth_autoload_type(\%main::, $meth_as_octets, $type, $level, 0); + ::ok !XS::APItest::gv_fetchmeth_autoload_type(\%main::, "method", $type, $level, 0); + + { + local *AUTOLOAD = sub { 1 }; + ::is XS::APItest::gv_fetchmeth_autoload_type(\%main::, "method$type", $type, $level, 0), "*main::method$type", "Autoloading UTF-8 subs works"; + } + + { + no strict 'refs'; + ::ok !XS::APItest::gv_fetchmeth_autoload_type( + \%{"\357\275\215\357\275\201\357\275\211\357\275\216::"}, + "method", $type, $level, 0); + ::ok !XS::APItest::gv_fetchmeth_autoload_type( + \%{"\357\275\215\357\275\201\357\275\211\357\275\216::"}, + "method", $type, $level, 0); + } + } +} |