diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2017-01-23 22:24:29 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2017-01-23 22:25:13 +0800 |
commit | 3d8b56c2a4b3f3f29de7b9804c85a10d077502f8 (patch) | |
tree | 71f877415f205bed6e00a25be4d8de22b9526382 | |
parent | 399b7b695a2ffe5ae2b07628860712fc76dfe03c (diff) | |
download | dexon-solidity-3d8b56c2a4b3f3f29de7b9804c85a10d077502f8.tar.gz dexon-solidity-3d8b56c2a4b3f3f29de7b9804c85a10d077502f8.tar.zst dexon-solidity-3d8b56c2a4b3f3f29de7b9804c85a10d077502f8.zip |
test: add tests about functions and events of the same name
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 6b9d50a9..39fbc019 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1387,6 +1387,53 @@ BOOST_AUTO_TEST_CASE(event_call) 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) { char const* text = R"( |