plan
skip_all
=>
"javap from Java SDK required: $!"
unless
Java::Javap->javap_test();
plan
tests
=> 5;
my
$perl
= $^X;
my
$java2perl6
= File::Spec->catfile(
'bin'
,
'java2perl6api'
);
my
$java2perl6cmd
=
"$perl $java2perl6 --trace 0 --nocompile --javapopts '-classpath testjavas'"
;
my
$testclass
=
'IntTest'
;
`
$java2perl6cmd
--norecurse
$testclass
`;
if
( -f
"$testclass.pm6"
) {
ok(
"$testclass.pm6 in current dir"
);
unlink
"$testclass.pm6"
;
}
else
{
fail(
"$testclass.pm6 in current dir"
);
}
`
$java2perl6cmd
--norecurse --outdir newdir
$testclass
`;
my
$output_file
= File::Spec->catfile(
'newdir'
,
"$testclass.pm6"
);
if
( -f
$output_file
) {
ok(
"$testclass.pm6 in new dir"
);
rmtree
'newdir'
, 1;
}
else
{
fail(
"$testclass.pm6 in new dir"
);
}
$testclass
=
'com.example.NestedIntTest'
;
`
$java2perl6cmd
--norecurse --nest
$testclass
`;
my
$nested_location
= File::Spec->catfile(
'com'
,
'example'
,
'NestedIntTest.pm6'
);
if
( -f
$nested_location
) {
ok(
"$nested_location under current dir"
);
rmtree
'com'
, 1;
}
else
{
fail(
"$nested_location under current dir"
);
}
`
$java2perl6cmd
--norecurse --nest --outdir newdir
$testclass
`;
$nested_location
= File::Spec->catfile(
'newdir'
,
'com'
,
'example'
,
'NestedIntTest.pm6'
);
if
( -f
$nested_location
) {
ok(
"$nested_location under alternate dir"
);
rmtree
'newdir'
, 1;
}
else
{
fail(
"$nested_location under alternate dir"
);
}
`
$java2perl6cmd
--nest --recurse
$testclass
`;
my
$original_nested_location
= File::Spec->catfile(
'com'
,
'example'
,
'NestedIntTest.pm6'
);
my
$second_nested_location
= File::Spec->catfile(
'com'
,
'example'
,
'Second.pm6'
);
if
( -f
$second_nested_location
) {
ok(
"$second_nested_location under current dir"
);
rmtree
'com'
;
}
else
{
fail(
"$second_nested_location under current dir"
);
}