aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-26 22:35:44 +0800
committerchriseth <chris@ethereum.org>2017-06-26 22:42:43 +0800
commit336c9e8f321c9829340affbe57ae4f2c07fad4aa (patch)
tree2564effac3c1fc3c87b4905d49c49d4d2dc3460f
parent1a3066c3a1a9a9cbd16cd43e2725a4b03fc547cf (diff)
downloaddexon-solidity-336c9e8f321c9829340affbe57ae4f2c07fad4aa.tar.gz
dexon-solidity-336c9e8f321c9829340affbe57ae4f2c07fad4aa.tar.zst
dexon-solidity-336c9e8f321c9829340affbe57ae4f2c07fad4aa.zip
Some more tests.
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 6af5f503..7961dbc4 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5813,6 +5813,38 @@ BOOST_AUTO_TEST_CASE(warn_multiple_storage_storage_copies_fill_left)
CHECK_WARNING(text, "This assignment performs two copies to storage.");
}
+BOOST_AUTO_TEST_CASE(nowarn_swap_memory)
+{
+ char const* text = R"(
+ contract C {
+ struct S { uint a; uint b; }
+ function f() {
+ S memory x;
+ S memory y;
+ (x, y) = (y, x);
+ }
+ }
+ )";
+ CHECK_SUCCESS_NO_WARNINGS(text);
+}
+
+BOOST_AUTO_TEST_CASE(nowarn_swap_storage_pointers)
+{
+ char const* text = R"(
+ contract C {
+ struct S { uint a; uint b; }
+ S x; S y;
+ function f() {
+ S storage x_local = x;
+ S storage y_local = y;
+ S storage z_local = x;
+ (x, y_local, x_local, z_local) = (y, x_local, y_local, y);
+ }
+ }
+ )";
+ CHECK_SUCCESS_NO_WARNINGS(text);
+}
+
BOOST_AUTO_TEST_CASE(warn_unused_local)
{
char const* text = R"(