aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-10 21:18:00 +0800
committerGitHub <noreply@github.com>2018-07-10 21:18:00 +0800
commitd9c3b10b1c5ad5d9dffbaceb48cd99e7293a6c56 (patch)
treef7755f7c68f324eaa784abff71e8fd37747401df /test/libsolidity/SolidityEndToEndTest.cpp
parent5c404fcfac113d2e25f80b298e485099baa27fb8 (diff)
parent951b745bd9324c2b07049ab9565ed7c3438fcb89 (diff)
downloaddexon-solidity-d9c3b10b1c5ad5d9dffbaceb48cd99e7293a6c56.tar.gz
dexon-solidity-d9c3b10b1c5ad5d9dffbaceb48cd99e7293a6c56.tar.zst
dexon-solidity-d9c3b10b1c5ad5d9dffbaceb48cd99e7293a6c56.zip
Merge pull request #4465 from ethereum/tupleAssignment
Disallow tuple assignment with mismatching number of components.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp29
1 files changed, 2 insertions, 27 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index bc613868..ce00931b 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -7895,7 +7895,7 @@ BOOST_AUTO_TEST_CASE(tuples)
if (a != 1 || b != 2 || c[0] != 3) return 2;
(a, b) = (b, a);
if (a != 2 || b != 1) return 3;
- (a, , b, ) = (8, 9, 10, 11, 12);
+ (a, , b, , ) = (8, 9, 10, 11, 12);
if (a != 8 || b != 10) return 4;
}
}
@@ -7983,7 +7983,7 @@ BOOST_AUTO_TEST_CASE(destructuring_assignment)
if (loc != 3) return 9;
if (memArray.length != arrayData.length) return 10;
bytes memory memBytes;
- (x, memBytes, y[2], ) = (456, s, 789, 101112, 131415);
+ (x, memBytes, y[2], , ) = (456, s, 789, 101112, 131415);
if (x != 456 || memBytes.length != s.length || y[2] != 789) return 11;
}
}
@@ -7992,31 +7992,6 @@ BOOST_AUTO_TEST_CASE(destructuring_assignment)
ABI_CHECK(callContractFunction("f(bytes)", u256(0x20), u256(5), string("abcde")), encodeArgs(u256(0)));
}
-BOOST_AUTO_TEST_CASE(destructuring_assignment_wildcard)
-{
- char const* sourceCode = R"(
- contract C {
- function f() public returns (uint) {
- uint a;
- uint b;
- uint c;
- (a,) = (1,);
- if (a != 1) return 1;
- (,b) = (2,3,4);
- if (b != 4) return 2;
- (, c,) = (5,6,7);
- if (c != 6) return 3;
- (a, b,) = (11, 12, 13);
- if (a != 11 || b != 12) return 4;
- (, a, b) = (11, 12, 13);
- if (a != 12 || b != 13) return 5;
- }
- }
- )";
- compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(0)));
-}
-
BOOST_AUTO_TEST_CASE(lone_struct_array_type)
{
char const* sourceCode = R"(