diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-01 19:30:30 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-02 03:51:52 +0800 |
commit | f63bb0a442bc3e7676739073fe498877c9b15927 (patch) | |
tree | 4ecd8c1eabd3ccf08e790fb7cabe7b77f851b201 | |
parent | a46552540ecb92aa21be60de4de9bd4c14857306 (diff) | |
download | dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar.gz dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar.bz2 dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar.lz dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar.xz dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.tar.zst dexon-solidity-f63bb0a442bc3e7676739073fe498877c9b15927.zip |
Add test for call/callcode/delegatecall to invalid address
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 60a0607a..e6c816f4 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9897,6 +9897,28 @@ BOOST_AUTO_TEST_CASE(inlineasm_empty_let) BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(0), u256(0))); } +BOOST_AUTO_TEST_CASE(bare_call_invalid_address) +{ + char const* sourceCode = R"( + contract C { + /// Calling into non-existant account is successful (creates the account) + function f() external constant returns (bool) { + return address(0x4242).call(); + } + function g() external constant returns (bool) { + return address(0x4242).callcode(); + } + function h() external constant returns (bool) { + return address(0x4242).delegatecall(); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("h()") == encodeArgs(u256(1))); +} + BOOST_AUTO_TEST_CASE(delegatecall_return_value) { char const* sourceCode = R"DELIMITER( |