aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-03 22:22:03 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-08-03 22:22:03 +0800
commit1e4b5886d61328d951fc03dc88cfc3dd722a3a00 (patch)
tree15196aa2588e31f6d8bf135b9b4a7a7acb6263a7 /test/libsolidity/SolidityEndToEndTest.cpp
parentc0a169ca90b780d102442aca98d1c510dac47464 (diff)
downloaddexon-solidity-1e4b5886d61328d951fc03dc88cfc3dd722a3a00.tar.gz
dexon-solidity-1e4b5886d61328d951fc03dc88cfc3dd722a3a00.tar.zst
dexon-solidity-1e4b5886d61328d951fc03dc88cfc3dd722a3a00.zip
Allow assignments to local variables of mapping types.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index e9e7c93b..2ae13963 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -1478,6 +1478,28 @@ BOOST_AUTO_TEST_CASE(multi_level_mapping)
testContractAgainstCpp("f(uint256,uint256,uint256)", f, u256(5), u256(4), u256(0));
}
+BOOST_AUTO_TEST_CASE(mapping_local_assignment)
+{
+ char const* sourceCode = R"(
+ contract test {
+ mapping(uint8 => uint8) m1;
+ mapping(uint8 => uint8) m2;
+ function f() public returns (uint8, uint8, uint8, uint8) {
+ mapping(uint8 => uint8) storage m = m1;
+ m[1] = 42;
+
+ m = m2;
+ m[2] = 21;
+
+ return (m1[1], m1[2], m2[1], m2[2]);
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(byte(42), byte(0), byte(0), byte(21)));
+}
+
BOOST_AUTO_TEST_CASE(structs)
{
char const* sourceCode = R"(