diff options
author | Federico Bond <federicobond@gmail.com> | 2017-09-30 05:45:17 +0800 |
---|---|---|
committer | Federico Bond <federicobond@gmail.com> | 2017-09-30 06:17:31 +0800 |
commit | 6d9544795543498e9bc92943c41f07c2daf3bb78 (patch) | |
tree | dcddcbd78f6f76db0c8197334006f4e57f58c6c0 /test | |
parent | ba7c5d2305d3486ddd699637a881ee229627082f (diff) | |
download | dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar.gz dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar.bz2 dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar.lz dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar.xz dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.tar.zst dexon-solidity-6d9544795543498e9bc92943c41f07c2daf3bb78.zip |
Emit error when declaring event with same name and arguments twice
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index c3a1ce08..8b112257 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1395,6 +1395,61 @@ BOOST_AUTO_TEST_CASE(events_with_same_name) BOOST_CHECK(success(text)); } +BOOST_AUTO_TEST_CASE(events_with_same_name_unnamed_arguments) +{ + char const* text = R"( + contract test { + event A(uint); + event A(uint, uint); + } + )"; + CHECK_SUCCESS(text); +} + +BOOST_AUTO_TEST_CASE(events_with_same_name_different_types) +{ + char const* text = R"( + contract test { + event A(uint); + event A(bytes); + } + )"; + CHECK_SUCCESS(text); +} + +BOOST_AUTO_TEST_CASE(double_event_declaration) +{ + char const* text = R"( + contract test { + event A(uint i); + event A(uint i); + } + )"; + CHECK_ERROR(text, DeclarationError, "Event with same name and arguments defined twice."); +} + +BOOST_AUTO_TEST_CASE(double_event_declaration_ignores_anonymous) +{ + char const* text = R"( + contract test { + event A(uint i); + event A(uint i) anonymous; + } + )"; + CHECK_ERROR(text, DeclarationError, "Event with same name and arguments defined twice."); +} + +BOOST_AUTO_TEST_CASE(double_event_declaration_ignores_indexed) +{ + char const* text = R"( + contract test { + event A(uint i); + event A(uint indexed i); + } + )"; + CHECK_ERROR(text, DeclarationError, "Event with same name and arguments defined twice."); +} + BOOST_AUTO_TEST_CASE(event_call) { char const* text = R"( |