[libinline-java-perl] 291/398: ok
Jonas Smedegaard
dr at jones.dk
Thu Feb 26 11:43:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.55
in repository libinline-java-perl.
commit 21ffe26c174cfa41fd500ccee64277b2cb7e7ffd
Author: patrick_leb <>
Date: Sat Feb 28 14:12:00 2004 +0000
ok
---
Java/Natives/Makefile.PL | 1 +
Java/Natives/t/01_init.t | 10 ++++
Java/Natives/t/02_perl_natives.t | 118 +++++++++++++++++++++++++++++++++++++++
Java/Portable.pm | 3 +
t/12_1_callbacks.t | 1 -
5 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/Java/Natives/Makefile.PL b/Java/Natives/Makefile.PL
index 1f82949..b302b49 100644
--- a/Java/Natives/Makefile.PL
+++ b/Java/Natives/Makefile.PL
@@ -8,5 +8,6 @@ WriteMakefile(
INC => join(' ', @main::I),
LIBS => [join(' ', @main::L) . " -ljvm"],
# CCFLAGS => '-D_REENTRANT',
+ clean => {FILES => "_Inline_test"},
) ;
diff --git a/Java/Natives/t/01_init.t b/Java/Natives/t/01_init.t
new file mode 100644
index 0000000..d889213
--- /dev/null
+++ b/Java/Natives/t/01_init.t
@@ -0,0 +1,10 @@
+use strict ;
+use Test ;
+
+BEGIN {
+ plan(tests => 1) ;
+ mkdir('./_Inline_test', 0777) unless -e './_Inline_test' ;
+}
+
+
+ok(1) ;
diff --git a/Java/Natives/t/02_perl_natives.t b/Java/Natives/t/02_perl_natives.t
new file mode 100644
index 0000000..7b6932c
--- /dev/null
+++ b/Java/Natives/t/02_perl_natives.t
@@ -0,0 +1,118 @@
+use strict ;
+use Test ;
+
+
+BEGIN {
+ plan(tests => 5) ;
+}
+
+
+use Inline Config =>
+ DIRECTORY => './_Inline_test' ;
+
+use Inline::Java qw(caught) ;
+
+use Inline (
+ Java => 'DATA',
+) ;
+
+
+eval {
+ t121->init() ;
+ my $t = new t121() ;
+ ok($t->types_stub(1, 2, 3, 4, 5, 6, 1, 2, "1000"), 1024) ;
+ ok($t->array_stub([34, 56], ["toto", "789"]), 789 + 34) ;
+
+ my $t2 = new t1212() ;
+ ok($t2->types_stub(1, 2, 3, 4, 5, 6, 1, 2, "1000"), 1024) ;
+
+ ok($t->callback_stub(), "toto") ;
+ ok($t->__get_private()->{proto}->ObjectCount(), 2) ;
+} ;
+if ($@){
+ if (caught("java.lang.Throwable")){
+ $@->printStackTrace() ;
+ die("Caught Java Exception") ;
+ }
+ else{
+ die $@ ;
+ }
+}
+
+
+##################################
+
+package t121 ;
+sub types {
+ my $this = shift ;
+
+ my $sum = 0 ;
+ map {$sum += $_} @_ ;
+ return $sum ;
+}
+
+
+sub array {
+ my $this = shift ;
+ my $i = shift ;
+ my $str = shift ;
+
+ return $i->[0] + $str->[1] ;
+}
+
+
+sub callback {
+ my $this = shift ;
+
+ return $this->get_name() ;
+}
+
+
+package main ;
+__DATA__
+
+__Java__
+
+
+import java.io.* ;
+import org.perl.inline.java.* ;
+
+class t121 extends InlineJavaPerlNatives {
+ static public boolean got14(){
+ return System.getProperty("java.version").startsWith("1.4") ;
+ }
+
+ public t121() throws InlineJavaException {
+ }
+
+ static public void init() throws InlineJavaException {
+ init("test") ;
+ }
+
+ public String types_stub(byte b, short s, int i, long j, float f, double d,
+ boolean x, char c, String str){
+ return types(b, s, i, j, f, d, x, c, str) ;
+ }
+ public native String types(byte b, short s, int i, long j, float f, double d,
+ boolean x, char c, String str) ;
+
+ public String array_stub(int i[], String str[]){
+ return array(i, str) ;
+ }
+ private native String array(int i[], String str[]) ;
+
+ public String callback_stub(){
+ return callback() ;
+ }
+ public native String callback() ;
+
+ public String get_name(){
+ return "toto" ;
+ }
+} ;
+
+
+class t1212 extends t121 {
+ public t1212() throws InlineJavaException {
+ }
+} ;
diff --git a/Java/Portable.pm b/Java/Portable.pm
index b96437d..82d2730 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -202,6 +202,9 @@ sub portable {
hpux => {
GOT_NEXT_FREE_PORT => 0,
},
+ solaris => {
+ GOT_NEXT_FREE_PORT => 0,
+ },
} ;
if (! exists($defmap->{$key})){
diff --git a/t/12_1_callbacks.t b/t/12_1_callbacks.t
index 7f0c9c5..d8aa1c3 100755
--- a/t/12_1_callbacks.t
+++ b/t/12_1_callbacks.t
@@ -6,7 +6,6 @@ use Inline Config =>
use Inline (
Java => 'DATA',
- PORT => 17890,
STUDY => ['org.perl.inline.java.InlineJavaPerlCaller'],
STARTUP_DELAY => 20,
) ;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git
More information about the Pkg-perl-cvs-commits
mailing list