aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-16 15:37:58 +0800
committerGitHub <noreply@github.com>2018-05-16 15:37:58 +0800
commit7f965c8671cbbd538fd0dada5a936dc58687d029 (patch)
treec76fa0ada18d4318dcb58c19a18eef47df990e8a /test/libsolidity/SolidityEndToEndTest.cpp
parent2ba0002998d12ea412f17d55b643ec85c02e6a30 (diff)
parent3ca6738114f9ae410c7488a1b1d66eeec92833c6 (diff)
downloaddexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar.gz
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar.bz2
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar.lz
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar.xz
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.tar.zst
dexon-solidity-7f965c8671cbbd538fd0dada5a936dc58687d029.zip
Merge pull request #4004 from ethereum/mulitVariableAssignment
Multi variable declarations
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-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 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"(