summaryrefslogtreecommitdiff
path: root/ext/XS-APItest
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-10-08 23:55:04 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-09 23:14:07 -0700
commit6911735f50121ad015d280f86e257e8e9eae797a (patch)
tree4d213e483049cb2b5dd1108c0a44e93c4302a6c3 /ext/XS-APItest
parent13087dd8e6c0257d4e1c28a81f9976d5e382e425 (diff)
downloadperl-6911735f50121ad015d280f86e257e8e9eae797a.tar.gz
Tests for XS AUTOLOAD routines
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r--ext/XS-APItest/APItest.pm2
-rw-r--r--ext/XS-APItest/APItest.xs10
-rw-r--r--ext/XS-APItest/t/autoload.t14
3 files changed, 26 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm
index a3792d477f..c6426d3842 100644
--- a/ext/XS-APItest/APItest.pm
+++ b/ext/XS-APItest/APItest.pm
@@ -24,6 +24,8 @@ sub import {
if ($sym_name =~ /::$/) {
# Skip any subpackages that are clearly OO
next if *{$glob}{HASH}{'new'};
+ # Skip AutoLoader, too, as it’s a special case
+ next if $sym_name eq 'AutoLoader::';
push @stashes, "$stash_name$sym_name", *{$glob}{HASH};
} elsif (ref $glob eq 'SCALAR' || *{$glob}{CODE}) {
if ($exports) {
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 0f09c3a95c..96efeb4cfd 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -1517,6 +1517,16 @@ void
ptr_table_clear(table)
XS::APItest::PtrTable table
+MODULE = XS::APItest::AutoLoader PACKAGE = XS::APItest::AutoLoader
+
+SV *
+AUTOLOAD()
+ CODE:
+ RETVAL = newSVpvn_flags(SvPVX(cv), SvCUR(cv), SvUTF8(cv));
+ OUTPUT:
+ RETVAL
+
+
MODULE = XS::APItest PACKAGE = XS::APItest
PROTOTYPES: DISABLE
diff --git a/ext/XS-APItest/t/autoload.t b/ext/XS-APItest/t/autoload.t
new file mode 100644
index 0000000000..dd89c501a0
--- /dev/null
+++ b/ext/XS-APItest/t/autoload.t
@@ -0,0 +1,14 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use XS::APItest;
+
+is XS::APItest::AutoLoader::frob(), 'frob', 'name passed to XS AUTOLOAD';
+is "XS::APItest::AutoLoader::fr\0b"->(), "fr\0b",
+ 'name with embedded null passed to XS AUTOLOAD';
+is "XS::APItest::AutoLoader::fr\x{1ed9}b"->(), "fr\x{1ed9}b",
+ 'Unicode name passed to XS AUTOLOAD';