summaryrefslogtreecommitdiff
path: root/ext/XS-APItest
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-09-25 22:15:55 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-06 13:01:06 -0700
commit772d5078e19623501bc9e2e30401b270f2b64bcc (patch)
tree40033bb13cd2bb2fb414c1e2c880f01e202814ed /ext/XS-APItest
parentc5540e1cf88a13d2e3c4bd0f68265301c762bc26 (diff)
downloadperl-772d5078e19623501bc9e2e30401b270f2b64bcc.tar.gz
gv.c: gv_fetchmeth_pvn UTF8 cleanup.
Since gv_fetchmeth_pvn is primarily used from within gv.c, and not much of anything is passing in the flag yet, this has no visible changes on the Perl level; So tests remain entirely in XS::APItest for the time being.
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r--ext/XS-APItest/t/gv_fetchmeth.t33
1 files changed, 31 insertions, 2 deletions
diff --git a/ext/XS-APItest/t/gv_fetchmeth.t b/ext/XS-APItest/t/gv_fetchmeth.t
index bcce7c1271..9f6e884a11 100644
--- a/ext/XS-APItest/t/gv_fetchmeth.t
+++ b/ext/XS-APItest/t/gv_fetchmeth.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 40;
use_ok('XS::APItest');
@@ -20,7 +20,7 @@ for my $type ( 0..3 ) {
for my $type ( 0..3 ) {
my $meth = "gen$type";
- ok !XS::APItest::gv_fetchmeth_type(\%::, $meth, $type, -1, 0), "With level = -1, $types[$type] returns false";
+ ok !XS::APItest::gv_fetchmeth_type(\%::, $meth, $type, -1, 0), "With level = -1, $types[$type] returns false.";
ok !$::{$meth}, "...and doesn't vivify the glob.";
ok !XS::APItest::gv_fetchmeth_type(\%::, $meth, $type, 0, 0), "With level = 0, $types[$type] still returns false.";
@@ -36,3 +36,32 @@ ok !XS::APItest::gv_fetchmeth_type(\%::, "method\0not quite!", 0, $level, 0), "g
ok !XS::APItest::gv_fetchmeth_type(\%::, "method\0not quite!", 1, $level, 0), "gv_fetchmeth_sv() is nul-clean";
is XS::APItest::gv_fetchmeth_type(\%::, "method\0not quite!", 2, $level, 0), "*main::method", "gv_fetchmeth_pv() is not nul-clean";
ok !XS::APItest::gv_fetchmeth_type(\%::, "method\0not quite!", 3, $level, 0), "gv_fetchmeth_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_type(\%main::, "method", $type, $level, 0), "*main::method", "$types[$type] is UTF-8 clean";
+ ::ok !XS::APItest::gv_fetchmeth_type(\%main::, $meth_as_octets, $type, $level, 0);
+ ::ok !XS::APItest::gv_fetchmeth_type(\%main::, "method", $type, $level, 0);
+
+ {
+ no strict 'refs';
+ ::ok !XS::APItest::gv_fetchmeth_type(
+ \%{"\357\275\215\357\275\201\357\275\211\357\275\216::"},
+ "method", $type, $level, 0);
+ ::ok !XS::APItest::gv_fetchmeth_type(
+ \%{"\357\275\215\357\275\201\357\275\211\357\275\216::"},
+ "method", $type, $level, 0);
+ }
+ }
+}