aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-09 22:26:27 +0800
committerchriseth <c@ethdev.com>2015-10-09 22:26:27 +0800
commitc54a033bf036d16651fb992689adfcffb2f3a951 (patch)
treec202cdab8002d74d9032116b0e1cd2b1515b30a1 /test/libsolidity/SolidityEndToEndTest.cpp
parentb9a166061bc94cd06458c945d66bf52e76e84b70 (diff)
downloaddexon-solidity-c54a033bf036d16651fb992689adfcffb2f3a951.tar.gz
dexon-solidity-c54a033bf036d16651fb992689adfcffb2f3a951.tar.zst
dexon-solidity-c54a033bf036d16651fb992689adfcffb2f3a951.zip
Tests for multi variable declaration.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 3126c1cc..08f62963 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5613,6 +5613,30 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library)
BOOST_CHECK_EQUAL(m_state.balance(libraryAddress), 0);
}
+BOOST_AUTO_TEST_CASE(multi_variable_declaration)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function g() returns (uint a, uint b, uint c) {
+ a = 1; b = 2; c = 3;
+ }
+ function f() returns (bool) {
+ var (x, y, z) = g();
+ if (x != 1 || y != 2 || z != 3) return false;
+ var (, a,) = g();
+ if (a != 2) return false;
+ var (b,) = g();
+ if (b != 1) return false;
+ var (,c) = g();
+ if (c != 3) return false;
+ return true;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("f()", encodeArgs()) == encodeArgs(true));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}