diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-26 18:51:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 18:51:12 +0800 |
commit | a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365 (patch) | |
tree | b8e4cd938ada219278e3c0ea5509b4ef0a793bdd /test | |
parent | c328ab411b63fe182125e976eb05b4449fdd892d (diff) | |
parent | 5a75581f6643a229ab12a861d0b0663ea3e5158e (diff) | |
download | dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar.gz dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar.bz2 dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar.lz dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar.xz dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.tar.zst dexon-solidity-a0b0df2d98f7d4c60fe9fb9e79739c0c09b94365.zip |
Merge pull request #2460 from ethereum/disallowMultiModifier
Disallow invoking the same modifier multiple times.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index e18303f5..1088b3d5 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1049,6 +1049,28 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation_local_variables) CHECK_SUCCESS(text); } +BOOST_AUTO_TEST_CASE(function_modifier_double_invocation) +{ + char const* text = R"( + contract B { + function f(uint x) mod(x) mod(2) { } + modifier mod(uint a) { if (a > 0) _; } + } + )"; + CHECK_ERROR(text, DeclarationError, "Modifier already used for this function"); +} + +BOOST_AUTO_TEST_CASE(base_constructor_double_invocation) +{ + char const* text = R"( + contract C { function C(uint a) {} } + contract B is C { + function B() C(2) C(2) {} + } + )"; + CHECK_ERROR(text, DeclarationError, "Base constructor already provided"); +} + BOOST_AUTO_TEST_CASE(legal_modifier_override) { char const* text = R"( |