test: add tests about functions and events of the same name

This commit is contained in:
Yoichi Hirai 2017-01-23 15:24:29 +01:00
parent 399b7b695a
commit 3d8b56c2a4
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -1387,6 +1387,53 @@ BOOST_AUTO_TEST_CASE(event_call)
CHECK_SUCCESS(text); CHECK_SUCCESS(text);
} }
BOOST_AUTO_TEST_CASE(event_function_inheritance_clash)
{
char const* text = R"(
contract A {
function dup() returns (uint) {
return 1;
}
}
contract B {
event dup();
}
contract C is A, B {
}
)";
CHECK_ERROR(text, DeclarationError, "Identifier already declared.");
}
BOOST_AUTO_TEST_CASE(function_event_inheritance_clash)
{
char const* text = R"(
contract B {
event dup();
}
contract A {
function dup() returns (uint) {
return 1;
}
}
contract C is B, A {
}
)";
CHECK_ERROR(text, DeclarationError, "Identifier already declared.");
}
BOOST_AUTO_TEST_CASE(function_event_in_contract_clash)
{
char const* text = R"(
contract A {
event dup();
function dup() returns (uint) {
return 1;
}
}
)";
CHECK_ERROR(text, DeclarationError, "Identifier already declared.");
}
BOOST_AUTO_TEST_CASE(event_inheritance) BOOST_AUTO_TEST_CASE(event_inheritance)
{ {
char const* text = R"( char const* text = R"(