summaryrefslogtreecommitdiff
path: root/ext/XS-Typemap
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2012-11-22 02:51:06 -0500
committerTony Cook <tony@develop-help.com>2012-12-20 09:31:31 +1100
commitb0bbf7604b0b32561cdc40ec984e20f9efd65587 (patch)
treee448010aff3d94313907a3f7175bd4411ef49b8c /ext/XS-Typemap
parenta14f212e110df050a6a4c36aee3706ff7814c496 (diff)
downloadperl-b0bbf7604b0b32561cdc40ec984e20f9efd65587.tar.gz
T_BOOL failure example
[perl #115796] T_BOOL failure example
Diffstat (limited to 'ext/XS-Typemap')
-rw-r--r--ext/XS-Typemap/Typemap.pm1
-rw-r--r--ext/XS-Typemap/Typemap.xs8
-rw-r--r--ext/XS-Typemap/t/Typemap.t12
3 files changed, 20 insertions, 1 deletions
diff --git a/ext/XS-Typemap/Typemap.pm b/ext/XS-Typemap/Typemap.pm
index 1090d9ada0..44e15350e3 100644
--- a/ext/XS-Typemap/Typemap.pm
+++ b/ext/XS-Typemap/Typemap.pm
@@ -55,6 +55,7 @@ $VERSION = '0.09';
T_ENUM
T_BOOL
T_BOOL_2
+ T_BOOL_OUT
T_U_INT
T_SHORT
T_U_SHORT
diff --git a/ext/XS-Typemap/Typemap.xs b/ext/XS-Typemap/Typemap.xs
index f341a7b956..dd34c39bd6 100644
--- a/ext/XS-Typemap/Typemap.xs
+++ b/ext/XS-Typemap/Typemap.xs
@@ -443,6 +443,14 @@ T_BOOL_2( in )
OUTPUT:
in
+void
+T_BOOL_OUT( out, in )
+ bool out
+ bool in
+ CODE:
+ out = in;
+ OUTPUT:
+ out
## T_U_INT
diff --git a/ext/XS-Typemap/t/Typemap.t b/ext/XS-Typemap/t/Typemap.t
index 93c197956f..5cad128115 100644
--- a/ext/XS-Typemap/t/Typemap.t
+++ b/ext/XS-Typemap/t/Typemap.t
@@ -6,7 +6,7 @@ BEGIN {
}
}
-use Test::More tests => 144;
+use Test::More tests => 146;
use strict;
use warnings;
@@ -159,6 +159,16 @@ ok( ! T_BOOL(undef) );
ok( !eval { T_BOOL_2(undef); 1 } );
}
+{
+ my ($in, $out);
+ $in = 1;
+ T_BOOL_OUT($out, $in);
+ ok($out, "T_BOOL_OUT, true in");
+ $in = 0;
+ T_BOOL_OUT($out, $in);
+ ok(!$out, "T_BOOL_OUT, false in");
+}
+
# T_U_SHORT aka U16
note("T_U_SHORT");
is( T_U_SHORT(32000), 32000);