my
$test_dir
;
my
$test_dir_vm
;
my
$build_dir
;
BEGIN {
$test_dir
=
$ENV
{SPVM_TEST_DIR};
$test_dir_vm
=
$ENV
{SPVM_TEST_DIR_VM};
$build_dir
=
$ENV
{SPVM_BUILD_DIR};
}
use
lib
"$test_dir_vm/lib"
;
use
MyTest
qw(compile_not_ok_file compile_not_ok)
;
{
compile_not_ok_file(
'CompileError::CallMethod::NotFound'
);
compile_not_ok_file(
'CompileError::CallMethod::ClassNotFound'
,);
{
my
$source
=
'class Tmp { static method main : int () { my $num = 1; $num->foo; } }'
;
compile_not_ok(
$source
);
}
{
my
$source
=
'class Tmp { static method main : int () { &foo; } method foo : void () {} }'
;
compile_not_ok(
$source
);
}
{
my
$source
=
'class Tmp { static method main : int () { my $object = new Tmp; $object->foo; } static method foo : void () {} }'
;
compile_not_ok(
$source
);
}
}
{
compile_not_ok_file(
'CompileError::Assign::StringToBytArray'
);
compile_not_ok_file(
'CompileError::Assign::DifferentObject'
);
compile_not_ok_file(
'CompileError::Assign::ConstToNoConst'
);
compile_not_ok_file(
'CompileError::Assign::NotNumericToNumeric'
);
compile_not_ok_file(
'CompileError::Assign::NarrwoingConvertionIntToByte'
);
compile_not_ok_file(
'CompileError::Assign::NarrwoingConvertionIntToShort'
);
compile_not_ok_file(
'CompileError::Assign::NarrwoingConvertionLongToByte'
);
compile_not_ok_file(
'CompileError::Assign::NarrwoingConvertionLongToInt'
);
compile_not_ok_file(
'CompileError::Assign::NarrwoingConvertionLongToShort'
);
compile_not_ok_file(
'CompileError::Assign::UnboxingDifferentType'
);
compile_not_ok_file(
'CompileError::Assign::BoxingDifferentType'
);
}
{
compile_not_ok_file(
'CompileError::Modulo::RightIsNotIntegral'
);
compile_not_ok_file(
'CompileError::Modulo::LeftIsNotIntegral'
);
}
{
compile_not_ok_file(
'CompileError::Isa::LeftIsNotObject'
);
}
{
compile_not_ok_file(
'CompileError::Convert::ConvertFromByteArrayToString'
);
compile_not_ok_file(
'CompileError::Convert::ConvertFromStringToByteArray'
);
compile_not_ok_file(
'CompileError::Convert::ConvertToRef'
);
compile_not_ok_file(
'CompileError::Convert::ConvertFromRef'
);
compile_not_ok_file(
'CompileError::Convert::ConvertFromMultiNumericType'
);
}
{
compile_not_ok_file(
'CompileError::Concat::RightIsNotString'
);
compile_not_ok_file(
'CompileError::Concat::LeftIsNotString'
);
}
{
compile_not_ok_file(
'CompileError::Divide::LeftIsNotNumeric'
);
compile_not_ok_file(
'CompileError::Divide::RightIsNotNumeric'
);
compile_not_ok_file(
'CompileError::Divide::DivuiLeftIsNotInt'
);
compile_not_ok_file(
'CompileError::Divide::DivuiRightIsNotInt'
);
compile_not_ok_file(
'CompileError::Divide::DivulLeftIsNotLong'
);
compile_not_ok_file(
'CompileError::Divide::DivulRightIsNotLong'
);
}
{
compile_not_ok_file(
'CompileError::Modulo::LeftIsNotIntegral'
,
qr/left.+%.+integer/
);
compile_not_ok_file(
'CompileError::Modulo::RightIsNotIntegral'
,
qr/right.+%.+integer/
);
compile_not_ok_file(
'CompileError::Modulo::RemuiLeftIsNotInt'
,
qr/left.+mod_uint.+int/
);
compile_not_ok_file(
'CompileError::Modulo::RemuiRightIsNotInt'
,
qr/right.+mod_uint.+int/
);
compile_not_ok_file(
'CompileError::Modulo::RemulLeftIsNotLong'
,
qr/left.+mod_ulong.+long/
);
compile_not_ok_file(
'CompileError::Modulo::RemulRightIsNotLong'
,
qr/right.+mod_ulong.+long/
);
}
{
compile_not_ok_file(
'CompileError::Weaken::IsweakFieldNotObjectType'
,
qr/isweak.*object/
);
compile_not_ok_file(
'CompileError::Weaken::UnweakenFieldNotObjectType'
,
qr/unweaken.*object/
);
compile_not_ok_file(
'CompileError::Weaken::WeakenFieldNotObjectType'
,
qr/weaken.*object/
);
}
{
{
{
my
$source
=
'class Tmp { static method main : void () { my $num = 0; $num-2; } }'
;
compile_not_ok(
$source
,
qr/Unexpected token "-2"/
);
}
}
}
{
compile_not_ok_file(
'CompileError::ComparisonOperator::GtNotNumeric'
);
compile_not_ok_file(
'CompileError::ComparisonOperator::GeNotNumeric'
);
compile_not_ok_file(
'CompileError::ComparisonOperator::LtNotNumeric'
);
compile_not_ok_file(
'CompileError::ComparisonOperator::LeNotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::Add::LeftIsNotNumeric'
);
compile_not_ok_file(
'CompileError::Add::RightIsNotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::Multiply::LeftIsNotNumeric'
);
compile_not_ok_file(
'CompileError::Multiply::RightIsNotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::Subtract::LeftIsNotNumeric'
);
compile_not_ok_file(
'CompileError::Subtract::RightIsNotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::UnaryMinus::NotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::UnaryPlus::NotNumeric'
);
}
{
compile_not_ok_file(
'CompileError::New::Private'
);
}
{
compile_not_ok_file(
'CompileError::BitOperator::NotIntegral'
);
}
done_testing;