diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 11 |
3 files changed, 31 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 185ba3bf..073d7d97 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -644,7 +644,6 @@ BOOST_AUTO_TEST_CASE(include_fallback_function) char const* interface = R"( [ { - "constant" : false, "payable": false, "type" : "fallback" } @@ -696,7 +695,6 @@ BOOST_AUTO_TEST_CASE(payable_fallback_unction) char const* interface = R"( [ { - "constant" : false, "payable": true, "type" : "fallback" } diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 1ecd7a2c..3c85d8a8 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4625,6 +4625,26 @@ BOOST_AUTO_TEST_CASE(failing_send) BOOST_REQUIRE(callContractFunction("callHelper(address)", c_helperAddress) == encodeArgs(true, 20)); } +BOOST_AUTO_TEST_CASE(send_zero_ether) +{ + // Sending zero ether to a contract should still invoke the fallback function + // (it previously did not because the gas stipend was not provided by the EVM) + char const* sourceCode = R"( + contract Receiver { + function () payable { + } + } + contract Main { + function s() returns (bool) { + var r = new Receiver(); + return r.send(0); + } + } + )"; + compileAndRun(sourceCode, 20, "Main"); + BOOST_REQUIRE(callContractFunction("s()") == encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(reusing_memory) { // Invoke some features that use memory and test that they do not interfere with each other. diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index ab0f9c7b..882557fd 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1124,6 +1124,17 @@ BOOST_AUTO_TEST_CASE(fallback_function_with_return_parameters) BOOST_CHECK(expectError(text) == Error::Type::TypeError); } +BOOST_AUTO_TEST_CASE(fallback_function_with_constant_modifier) +{ + char const* text = R"( + contract C { + uint x; + function() constant { x = 2; } + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(fallback_function_twice) { char const* text = R"( |