diff options
author | chriseth <chris@ethereum.org> | 2018-04-27 21:44:41 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-05-16 09:52:24 +0800 |
commit | c781baf7336af55abc33e1b63e6fc99a7e555d78 (patch) | |
tree | 1bab29687eaa45b50e6f241a9bac9de8a8018fe7 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 67d208d144a179e52e1aab3fbd1bd67fe20176b7 (diff) | |
download | dexon-solidity-c781baf7336af55abc33e1b63e6fc99a7e555d78.tar.gz dexon-solidity-c781baf7336af55abc33e1b63e6fc99a7e555d78.tar.zst dexon-solidity-c781baf7336af55abc33e1b63e6fc99a7e555d78.zip |
Add tests for multi variable declaration statement.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 2db2aadd..42f69099 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7610,6 +7610,33 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration) ABI_CHECK(callContractFunction("f()", encodeArgs()), encodeArgs(true)); } +BOOST_AUTO_TEST_CASE(typed_multi_variable_declaration) +{ + char const* sourceCode = R"( + contract C { + struct S { uint x; } + S s; + function g() internal returns (uint, S storage, uint) { + s.x = 7; + return (1, s, 2); + } + function f() returns (bool) { + (uint x1, S storage y1, uint z1) = g(); + if (x1 != 1 || y1.x != 7 || z1 != 2) return false; + (, S storage y2,) = g(); + if (y2.x != 7) return false; + (uint x2,,) = g(); + if (x2 != 1) return false; + (,,uint z2) = g(); + if (z2 != 2) return false; + return true; + } + } + )"; + compileAndRun(sourceCode); + ABI_CHECK(callContractFunction("f()", encodeArgs()), encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(tuples) { char const* sourceCode = R"( |