Make (char*, size_t) typemap usable for strings of other types in Java.

Notably it now works for "unsigned char*" strings.

Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
This commit is contained in:
Vadim Zeitlin 2015-08-06 00:10:51 +02:00
commit a1bddd56eb
7 changed files with 37 additions and 3 deletions

View file

@ -1,14 +1,16 @@
use strict;
use warnings;
use Test::More tests => 7;
use Test::More tests => 10;
BEGIN { use_ok('char_binary') }
require_ok('char_binary');
my $t = char_binary::Test->new();
is($t->strlen('hile'), 4, "string typemap");
is($t->ustrlen('hile'), 4, "unsigned string typemap");
is($t->strlen("hil\0"), 4, "string typemap");
is($t->ustrlen("hil\0"), 4, "unsigned string typemap");
#
# creating a raw char*
@ -22,6 +24,7 @@ char_binary::pchar_setitem($pc, 4, 0);
is($t->strlen($pc), 4, "string typemap");
is($t->ustrlen($pc), 4, "unsigned string typemap");
$char_binary::var_pchar = $pc;
is($char_binary::var_pchar, "hola", "pointer case");