diff options
author | chriseth <c@ethdev.com> | 2017-01-13 00:56:05 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-01-24 19:06:40 +0800 |
commit | dea59bfbdc610b65018b613dc20322d98e9aa2b6 (patch) | |
tree | 3963481610f86ac08e11c32df9ec42155514d9d6 | |
parent | b52a60402d0885f8700658488b02bc48f7746aaf (diff) | |
download | dexon-solidity-dea59bfbdc610b65018b613dc20322d98e9aa2b6.tar.gz dexon-solidity-dea59bfbdc610b65018b613dc20322d98e9aa2b6.tar.zst dexon-solidity-dea59bfbdc610b65018b613dc20322d98e9aa2b6.zip |
Test for initializing recursive structs.
-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 da7adbbf..e8e5ced1 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -8992,6 +8992,28 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment) compileAndRun(sourceCode, 0, "C2"); } +BOOST_AUTO_TEST_CASE(recursive_structs) +{ + char const* sourceCode = R"( + contract C { + struct S { + S[] x; + } + S sstorage; + function f() returns (uint) { + S memory s; + s.x = new S[](10); + delete s; + sstorage.x.length++; + delete sstorage; + return 1; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1))); +} + BOOST_AUTO_TEST_SUITE_END() } |