File: 08_study.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 (117 lines) | stat: -rw-r--r-- 1,671 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package study ;

use strict ;
use Test ;


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

use Inline(
	Java => 'DATA',
) ;

# There once was a bug with importing code twice.
use Inline(
	Java => 'STUDY',
	AUTOSTUDY => 1,
	STUDY => ['t.types'],
	CLASSPATH => '.',
) ;
use Inline(
	Java => 'STUDY',
	AUTOSTUDY => 1,
	STUDY => ['t.types'],
	CLASSPATH => '.',
) ;				   


package toto ;

use Inline(
	Java => 'STUDY',
	AUTOSTUDY => 1,
	STUDY => ['t.types'],
	CLASSPATH => '.',
) ;
use Inline(
	Java => 'STUDY',
	AUTOSTUDY => 1,
	STUDY => ['t.types'],
	CLASSPATH => '.',
	PACKAGE => 'main',
) ;
package study ;

use Inline::Java qw(study_classes) ;



BEGIN {
	plan(tests => 11) ;
}

study_classes([
	't.no_const'
]) ;

my $t = new study::t::types() ;

{
	ok($t->func(), "study") ;
	ok($t->hm()->get("key"), "value") ;
	
	my $nc = new study::t::no_const() ;
	ok($nc->{i}, 5) ;
	
	my $a = new study::study::a8() ;
	ok($a->{i}, 50) ;
	ok($a->truth()) ;
	ok($a->sa()->[1], 'titi') ;
	ok($a->sb()->[0]->get('toto'), 'titi') ;
	ok($a->sb()->[1]->get('error'), undef) ;

	my $toto_t = new toto::t::types() ;
	ok(1) ;
	my $main_t = new t::types() ;
	ok(1) ;
}

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


__DATA__

__Java__

// Use a public class
package study ;

import java.util.* ;

public class a8 {
	public int i = 50 ;
	
	public a8(){
	}

	public boolean truth(){
		return true ;
	}

	public String [] sa(){
		String a[] = {"toto", "titi"} ;
		return a ;
	}

	public HashMap [] sb(){
		HashMap h1 = new HashMap() ;
		HashMap h2 = new HashMap() ;
		h1.put("toto", "titi") ;
		h2.put("tata", "tete") ;

		HashMap a[] = {h1, h2} ;
		return a ;
	}
}