summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-09-06 15:21:06 +1000
committerTony Cook <tony@develop-help.com>2021-09-13 10:05:02 +1000
commitb61667640189f6de8d03dd67faf4f19915834bb4 (patch)
tree5937a562665a6241e973315fc176b25281da31d5 /ext
parent83b243fa48968f4349136fe6943f0c21313b217e (diff)
downloadperl-b61667640189f6de8d03dd67faf4f19915834bb4.tar.gz
test and fix using T_AVREF_REFCOUNT as an output parameter
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-Typemap/Typemap.pm1
-rw-r--r--ext/XS-Typemap/Typemap.xs6
-rw-r--r--ext/XS-Typemap/t/Typemap.t10
3 files changed, 16 insertions, 1 deletions
diff --git a/ext/XS-Typemap/Typemap.pm b/ext/XS-Typemap/Typemap.pm
index d6e86da86a..8d2fde9a71 100644
--- a/ext/XS-Typemap/Typemap.pm
+++ b/ext/XS-Typemap/Typemap.pm
@@ -44,6 +44,7 @@ our @EXPORT = (qw/
T_SVREF_REFCOUNT_FIXED_output
T_AVREF
T_AVREF_REFCOUNT_FIXED
+ T_AVREF_REFCOUNT_FIXED_output
T_HVREF
T_HVREF_REFCOUNT_FIXED
T_HVREF_REFCOUNT_FIXED_output
diff --git a/ext/XS-Typemap/Typemap.xs b/ext/XS-Typemap/Typemap.xs
index 353e04fb45..ed6f9d67b5 100644
--- a/ext/XS-Typemap/Typemap.xs
+++ b/ext/XS-Typemap/Typemap.xs
@@ -325,6 +325,12 @@ T_AVREF_REFCOUNT_FIXED( av )
OUTPUT:
RETVAL
+void
+T_AVREF_REFCOUNT_FIXED_output( OUT avref)
+ AV_FIXED *avref;
+ CODE:
+ avref = newAV();
+ av_push(avref, newSVpvs("test"));
## T_HVREF
diff --git a/ext/XS-Typemap/t/Typemap.t b/ext/XS-Typemap/t/Typemap.t
index 33f4e45306..dade5a01f6 100644
--- a/ext/XS-Typemap/t/Typemap.t
+++ b/ext/XS-Typemap/t/Typemap.t
@@ -6,7 +6,7 @@ BEGIN {
}
}
-use Test::More tests => 164;
+use Test::More tests => 167;
use strict;
#catch WARN_INTERNAL type errors, and anything else unexpected
@@ -79,6 +79,14 @@ is( T_AVREF_REFCOUNT_FIXED(\@array), \@array);
eval { T_AVREF_REFCOUNT_FIXED( \$sv ) };
ok( $@ );
+# output only
+SKIP:{
+ my $avr;
+ is_deeply([ T_AVREF_REFCOUNT_FIXED_output($avr) ], [ ], "call with non-ref lvalue, no return value");
+ ok(ref $avr, "output parameter now a reference")
+ or skip "Not a reference", 1;
+ is_deeply($avr, [ "test" ], "has expected entry");
+}
# T_HVREF - reference to a perl Hash
note("T_HVREF");