diff options
author | chriseth <c@ethdev.com> | 2015-06-06 06:45:47 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-06 06:45:47 +0800 |
commit | 187f5de2dd79b2868dc622aff4f44e65af2eabcc (patch) | |
tree | 25cb0cc9f54b81d36ceec069fde6285db5ff3627 /libsolidity | |
parent | 4141a0de5edc933fbed912dda92eb50a0e0aa90f (diff) | |
parent | 7581330e51e3e6619552e2906f790785486ed9f9 (diff) | |
download | dexon-solidity-187f5de2dd79b2868dc622aff4f44e65af2eabcc.tar.gz dexon-solidity-187f5de2dd79b2868dc622aff4f44e65af2eabcc.tar.zst dexon-solidity-187f5de2dd79b2868dc622aff4f44e65af2eabcc.zip |
Merge pull request #2096 from chriseth/sol_constantFallback
Fallback takes constant amount of gas, and send no gas with send.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 1d0f1fc2..89ed81e2 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -4187,6 +4187,28 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_signed) BOOST_CHECK(callContractFunction("q()") == encodeArgs(250)); } +BOOST_AUTO_TEST_CASE(failing_send) +{ + char const* sourceCode = R"( + contract Helper { + uint[] data; + function () { + data[9]; // trigger exception + } + } + contract Main { + function callHelper(address _a) returns (bool r, uint bal) { + r = !_a.send(5); + bal = this.balance; + } + } + )"; + compileAndRun(sourceCode, 0, "Helper"); + u160 const c_helperAddress = m_contractAddress; + compileAndRun(sourceCode, 20, "Main"); + BOOST_REQUIRE(callContractFunction("callHelper(address)", c_helperAddress) == encodeArgs(true, 20)); +} + BOOST_AUTO_TEST_SUITE_END() } |