diff options
author | chriseth <chris@ethereum.org> | 2018-07-13 07:23:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 07:23:28 +0800 |
commit | 052f19c6b0aac3b4f60ee8a7f340033e0b5350f0 (patch) | |
tree | 82027ba467f6851c64984c77538ee424ae74f645 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | f0bc1bce895f67ccd8b21e244d1b7cbd8c8f9453 (diff) | |
parent | 62645d530253c365ac09979135e9037f2bde2934 (diff) | |
download | dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.gz dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.bz2 dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.lz dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.xz dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.tar.zst dexon-solidity-052f19c6b0aac3b4f60ee8a7f340033e0b5350f0.zip |
Merge pull request #4431 from ethereum/tupleDeclaration
Disallow multi variable declarations with mismatching number of values.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index ad425d98..bee83007 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -8091,17 +8091,36 @@ BOOST_AUTO_TEST_CASE(multi_variable_declaration) function g() public returns (uint a, uint b, uint c) { a = 1; b = 2; c = 3; } - function f() public returns (bool) { + function h() public returns (uint a, uint b, uint c, uint d) { + a = 1; b = 2; c = 3; d = 4; + } + function f1() public returns (bool) { (uint x, uint y, uint z) = g(); if (x != 1 || y != 2 || z != 3) return false; (, uint a,) = g(); if (a != 2) return false; - (uint b,) = g(); + (uint b, , ) = g(); if (b != 1) return false; - (, uint c) = g(); + (, , uint c) = g(); if (c != 3) return false; return true; } + function f2() public returns (bool) { + (uint a1, , uint a3, ) = h(); + if (a1 != 1 || a3 != 3) return false; + (uint b1, uint b2, , ) = h(); + if (b1 != 1 || b2 != 2) return false; + (, uint c2, uint c3, ) = h(); + if (c2 != 2 || c3 != 3) return false; + (, , uint d3, uint d4) = h(); + if (d3 != 3 || d4 != 4) return false; + (uint e1, , uint e3, uint e4) = h(); + if (e1 != 1 || e3 != 3 || e4 != 4) return false; + return true; + } + function f() public returns (bool) { + return f1() && f2(); + } } )"; compileAndRun(sourceCode); |