File: 09_usages.t

package info (click to toggle)
libinline-java-perl 0.58~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 964 kB
  • ctags: 684
  • sloc: perl: 4,717; java: 2,844; makefile: 35
file content (70 lines) | stat: -rwxr-xr-x 1,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use strict ;
use Test ;


use Inline Config => 
           DIRECTORY => './_Inline_test';


BEGIN {
	plan(tests => 6) ;
}



package t09::p1 ;
use Inline(
	Java => qq |
		class t09p1 {
			public static String name = "p1" ;

			public t09p1(){
			}

			public static String get_prop(int n){
				return System.getProperty("prop" + n) ;
			}
		}
	|,
	NAME => 't09::p1',
	EXTRA_JAVA_ARGS => '-Dprop1="c:\program files" -Dprop3=42',
) ;


package t09::p2 ;
use Inline(
	Java => qq |
		class t09p2 {
			public static String name = "p2" ;
		}
	|,
	NAME => 't09::p2',
) ;



package t09::p3 ;
Inline->bind(
	Java => qq |
		class t09p3 {
			public static String name = "p3" ;

		}
	|,
	NAME => 't09::p3',
) ;


package main ;

my $t = new t09::p1::t09p1() ;

{
	ok($t->{name}, "p1") ;
	ok($t->get_prop(1), 'c:\program files') ;
	ok($t->get_prop(3), 42) ;
	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;
	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;
}

ok($t->__get_private()->{proto}->ObjectCount(), 1) ;