diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-03 03:21:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-03 03:21:16 +0800 |
commit | e7a1e1abe73700db6bfee9dd2b058b16cc5b2002 (patch) | |
tree | b7b79f72605e16e7f86f962f6b07c787eb24a85a /test | |
parent | e7cea2f684cd754be0092093d97821604c6e65a2 (diff) | |
parent | 1e7b6875b7c5ddc9d257bac65e17d25b8f26fdd2 (diff) | |
download | dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar.gz dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar.bz2 dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar.lz dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar.xz dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.tar.zst dexon-solidity-e7a1e1abe73700db6bfee9dd2b058b16cc5b2002.zip |
Merge pull request #2997 from federicobond/duplicate-events
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"( |