aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-09-05 21:47:03 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-09-06 18:37:01 +0800
commit9ca7472089a9f4d8bfec20e9e55c4f7ed2fb502e (patch)
tree02763f7df79f27cac82373f078d98ae76ab2155e /test/libsolidity
parentf687635e4743a1e12d01fb082a4f8a76a759ab48 (diff)
downloaddexon-solidity-9ca7472089a9f4d8bfec20e9e55c4f7ed2fb502e.tar.gz
dexon-solidity-9ca7472089a9f4d8bfec20e9e55c4f7ed2fb502e.tar.zst
dexon-solidity-9ca7472089a9f4d8bfec20e9e55c4f7ed2fb502e.zip
Provide gas stipend manually for send(0).
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp20
1 files changed, 20 insertions, 0 deletions
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.