diff options
author | Tony Cook <tony@develop-help.com> | 2021-09-06 14:50:48 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-09-13 10:05:02 +1000 |
commit | ade1dcccb274812424b79cdbce70a7110d5285a7 (patch) | |
tree | 5de2e06484f4a08eb4e3b5b15e124b25b56d55d6 /ext | |
parent | 6c168fa48629feec620455099a41f5a9dbf63d3b (diff) | |
download | perl-ade1dcccb274812424b79cdbce70a7110d5285a7.tar.gz |
test and fix using T_SVREF_REFCOUNT as an output parameter
Diffstat (limited to 'ext')
-rw-r--r-- | ext/XS-Typemap/Typemap.pm | 1 | ||||
-rw-r--r-- | ext/XS-Typemap/Typemap.xs | 5 | ||||
-rw-r--r-- | ext/XS-Typemap/t/Typemap.t | 10 |
3 files changed, 15 insertions, 1 deletions
diff --git a/ext/XS-Typemap/Typemap.pm b/ext/XS-Typemap/Typemap.pm index 49cebddd65..c1b5505e8a 100644 --- a/ext/XS-Typemap/Typemap.pm +++ b/ext/XS-Typemap/Typemap.pm @@ -41,6 +41,7 @@ our @EXPORT = (qw/ T_SV_output T_SVREF T_SVREF_REFCOUNT_FIXED + T_SVREF_REFCOUNT_FIXED_output T_AVREF T_AVREF_REFCOUNT_FIXED T_HVREF diff --git a/ext/XS-Typemap/Typemap.xs b/ext/XS-Typemap/Typemap.xs index 14417da3be..d0703be2e5 100644 --- a/ext/XS-Typemap/Typemap.xs +++ b/ext/XS-Typemap/Typemap.xs @@ -297,6 +297,11 @@ T_SVREF_REFCOUNT_FIXED( svref ) OUTPUT: RETVAL +void +T_SVREF_REFCOUNT_FIXED_output( OUT svref ) + SVREF_FIXED svref + CODE: + svref = newSVpvn("test", 4); ## T_AVREF diff --git a/ext/XS-Typemap/t/Typemap.t b/ext/XS-Typemap/t/Typemap.t index 7422e6c5bd..835b35caf0 100644 --- a/ext/XS-Typemap/t/Typemap.t +++ b/ext/XS-Typemap/t/Typemap.t @@ -6,7 +6,7 @@ BEGIN { } } -use Test::More tests => 158; +use Test::More tests => 161; use strict; #catch WARN_INTERNAL type errors, and anything else unexpected @@ -55,6 +55,14 @@ is( ${ T_SVREF_REFCOUNT_FIXED($svref) }, $$svref ); eval { T_SVREF_REFCOUNT_FIXED( "fail - not ref" ) }; ok( $@ ); +# output only +SKIP:{ + my $svr; + is_deeply([ T_SVREF_REFCOUNT_FIXED_output($svr) ], [ ], "call with non-ref lvalue, no return value"); + ok(ref $svr, "output parameter now a reference") + or skip "Not a reference", 1; + is($$svr, "test", "reference to correct value"); +} # T_AVREF - reference to a perl Array note("T_AVREF"); |