mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2096 from chriseth/sol_constantFallback
Fallback takes constant amount of gas, and send no gas with send.
This commit is contained in:
commit
187f5de2dd
@ -4187,6 +4187,28 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_signed)
|
|||||||
BOOST_CHECK(callContractFunction("q()") == encodeArgs(250));
|
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()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user