use
SPVM
'TestCase::Exception'
;
my
$file
= basename $0;
{
eval
{ SPVM::TestCase::Exception->exception_zero_divide_int() };
my
$line
= __LINE__;
my
$error
= $@;
my
$die_line
= SPVM::TestCase::Exception->ZERO_DIVIDE_INT_LINE;
ok(
$die_line
> 0);
like(
$error
,
qr|\Qdivided by 0|
);
like(
$error
,
qr/\Q$file/
);
like(
$error
,
qr/$line/
);
like(
$error
,
qr/$die_line/
);
like(
$error
,
qr|Exception\.spvm|
);
}
{
{
ok(SPVM::TestCase::Exception->exception_eval_call_method());
}
{
eval
{ SPVM::TestCase::Exception->exception_call_stack() };
like($@,
qr/Error/
);
like($@,
qr/exception_die_return_int/
);
like($@,
qr/exception_call_stack/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_byte() };
like($@,
qr/Error/
);
like($@,
qr/exception_die_return_byte/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_short() };
like($@,
qr/Error/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_int() };
like($@,
qr/Error/
);
like($@,
qr/exception_die_return_int/
);
like($@,
qr/Exception\.spvm/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_long() };
like($@,
qr/Error/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_float() };
like($@,
qr/Error/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_double() };
like($@,
qr/Error/
);
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_void() };
like($@,
qr/Error/
);
}
{
ok(SPVM::TestCase::Exception->exception_die_return_int_eval_catch());
}
{
eval
{ SPVM::TestCase::Exception->exception_die_return_object() };
like($@,
qr/Error/
);
}
}
eval
{ SPVM::TestCase->eval_block_stack_check() };
ok($@);
{
ok(SPVM::TestCase::Exception->exception_set_field_object_undef());
}
{
ok(SPVM::TestCase::Exception->exception_get_field_object_undef());
}
{
eval
{ SPVM::TestCase::Exception->exception_callback() };
my
$error
= $@;
my
$callback_die_line
= SPVM::TestCase::Exception->CALLBACK_DIE_LINE;
ok(
$callback_die_line
> 0);
like(
$error
,
qr/Comparator Error/
);
like(
$error
,
qr|TestCase/Exception\.spvm line $callback_die_line|
);
}
{
ok(SPVM::TestCase::Exception->
die
);
}
done_testing;