diff options
author | chriseth <chris@ethereum.org> | 2017-12-31 03:13:41 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-04-12 19:09:38 +0800 |
commit | 7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57 (patch) | |
tree | 0f3ab32a927c35f24df13fe0072f5a011e15889a /test/libsolidity | |
parent | ae1d040285d97c2be0eb9d3e94a983975459f879 (diff) | |
download | dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.gz dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.bz2 dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.lz dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.xz dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.zst dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.zip |
Bubble up error messages.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index b6b26f49..41ebe462 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -10512,6 +10512,43 @@ BOOST_AUTO_TEST_CASE(require_with_message) ABI_CHECK(callContractFunction("h()"), encodeArgs(0, 0x40, 0x80, 0, 0x40, 3, "abc")); } +BOOST_AUTO_TEST_CASE(bubble_up_error_messages) +{ + char const* sourceCode = R"( + contract D { + function f() public { + revert("message"); + } + function g() public { + this.f(); + } + } + contract C { + D d = new D(); + function forward(address target, bytes data) internal returns (bool success, bytes retval) { + uint retsize; + assembly { + success := call(not(0), target, 0, add(data, 0x20), mload(data), 0, 0) + retsize := returndatasize() + } + retval = new bytes(retsize); + assembly { + returndatacopy(add(retval, 0x20), 0, returndatasize()) + } + } + function f() public returns (bool, bytes) { + return forward(address(d), msg.data); + } + function g() public returns (bool, bytes) { + return forward(address(d), msg.data); + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + ABI_CHECK(callContractFunction("f()"), encodeArgs(0, 0x40, 0x80, 0, 0x40, 3, "message")); + ABI_CHECK(callContractFunction("g()"), encodeArgs(0, 0x40, 0x80, 0, 0x40, 3, "message")); +} + BOOST_AUTO_TEST_CASE(negative_stack_height) { // This code was causing negative stack height during code generation |