diff options
author | chriseth <c@ethdev.com> | 2016-11-09 22:14:16 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:18 +0800 |
commit | 925d6741466a423b58cb519b6cc400863426607e (patch) | |
tree | 1b82670259db05e74277e033cb3a0117e6125dd8 /test | |
parent | f7a62c1e69e98cc612b7ed98497260b38234a162 (diff) | |
download | dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.gz dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.bz2 dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.lz dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.xz dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.zst dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.zip |
Disallow payable internal functions.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 62fb55f7..5916ed10 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4192,6 +4192,42 @@ BOOST_AUTO_TEST_CASE(public_function_type) BOOST_CHECK(expectError(text) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(payable_internal_function_type) +{ + char const* text = R"( + contract C { + function (uint) internal payable returns (uint) x; + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + +BOOST_AUTO_TEST_CASE(call_value_on_non_payable_function_type) +{ + char const* text = R"( + contract C { + function (uint) external returns (uint) x; + function f() { + x.value(2)(); + } + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + +BOOST_AUTO_TEST_CASE(call_value_on_payable_function_type) +{ + char const* text = R"( + contract C { + function (uint) external payable returns (uint) x; + function f() { + x.value(2)(1); + } + } + )"; + BOOST_CHECK(success(text)); +} + BOOST_AUTO_TEST_CASE(internal_function_as_external_parameter) { // It should not be possible to give internal functions |