Skip to content

Commit b2ff21e

Browse files
Add a test for exchanging Japanese data between COBOL and Java (#73)
1 parent f027ab4 commit b2ff21e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/misc.src/java-interface.at

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,48 @@ jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type i
472472
jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type is not 'int'
473473
jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type is not 'double'
474474
])
475+
AT_CLEANUP
476+
477+
AT_SETUP([Japanese])
478+
479+
AT_DATA([b.cbl], [
480+
identification division.
481+
program-id. b.
482+
data division.
483+
linkage section.
484+
01 arg-1 pic 9(3).
485+
01 arg-2 pic N(5).
486+
procedure division using arg-1 arg-2.
487+
display arg-1.
488+
display arg-2.
489+
add 1 to arg-1.
490+
move N"����������" to arg-2.
491+
])
492+
493+
AT_DATA([a.java], [
494+
import jp.osscons.opensourcecobol.libcobj.ui.*;
495+
public class a {
496+
public static void main(String@<:@@:>@ args) {
497+
b prog = new b();
498+
CobolResultSet rs = prog.execute(100, "����������");
499+
try{
500+
int ret1 = rs.getInt(1);
501+
String ret2 = rs.getString(2);
502+
System.out.println("ret1: " + ret1);
503+
System.out.println("ret2: " + ret2);
504+
} catch(CobolResultSetException e){
505+
e.printStackTrace();
506+
}
507+
}
508+
}
509+
])
510+
511+
AT_CHECK([cobj b.cbl])
512+
AT_CHECK([javac -encoding SJIS a.java])
513+
AT_CHECK([java -Dfile.encoding=SJIS a], [0],
514+
[100
515+
����������
516+
ret1: 101
517+
ret2: ����������
518+
])
475519
AT_CLEANUP

0 commit comments

Comments
 (0)