aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-07-11 21:04:33 +0800
committerchriseth <c@ethdev.com>2016-08-16 20:49:44 +0800
commit2a560b798b5f5ece6dfb500a8e03409c62332e41 (patch)
treea0d30e1941d498f59ba88563ca625fc83da6771d /test
parente3e4d84f3353eaaaadae7c1c6eac9e890188d0f8 (diff)
downloaddexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar.gz
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar.bz2
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar.lz
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar.xz
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.tar.zst
dexon-solidity-2a560b798b5f5ece6dfb500a8e03409c62332e41.zip
Throw if contract creation fails.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 1b7c5ea4..46756493 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6839,6 +6839,33 @@ BOOST_AUTO_TEST_CASE(skip_dynamic_types_for_structs)
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2), u256(6)));
}
+BOOST_AUTO_TEST_CASE(failed_create)
+{
+ char const* sourceCode = R"(
+ contract D { }
+ contract C {
+ uint public x;
+ function f(uint amount) returns (address) {
+ x++;
+ return (new D).value(amount)();
+ }
+ function stack(uint depth) returns (address) {
+ if (depth < 1024)
+ return this.stack(depth - 1);
+ else
+ return f(0);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 20, "C");
+ BOOST_CHECK(callContractFunction("f(uint256)", 20) != encodeArgs(u256(0)));
+ BOOST_CHECK(callContractFunction("x()") == encodeArgs(u256(1)));
+ BOOST_CHECK(callContractFunction("f(uint256)", 20) == encodeArgs());
+ BOOST_CHECK(callContractFunction("x()") == encodeArgs(u256(1)));
+ BOOST_CHECK(callContractFunction("stack(uint256)", 1023) == encodeArgs());
+ BOOST_CHECK(callContractFunction("x()") == encodeArgs(u256(1)));
+}
+
BOOST_AUTO_TEST_CASE(create_dynamic_array_with_zero_length)
{
char const* sourceCode = R"(