aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-06-03 01:03:05 +0800
committerchriseth <c@ethdev.com>2016-06-05 03:51:48 +0800
commit1c3a64026bde5c484410bd01440624be938caff2 (patch)
tree03ceb46f5d5281bfa2182c59317116c2402a3932 /test
parent754a992500a96f22a49388348cfd504a6749178e (diff)
downloaddexon-solidity-1c3a64026bde5c484410bd01440624be938caff2.tar.gz
dexon-solidity-1c3a64026bde5c484410bd01440624be938caff2.tar.zst
dexon-solidity-1c3a64026bde5c484410bd01440624be938caff2.zip
Add a test for a struct accessor.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 9b97b916..07bf6759 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6812,6 +6812,32 @@ BOOST_AUTO_TEST_CASE(skip_dynamic_types)
BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(7), u256(8)));
}
+BOOST_AUTO_TEST_CASE(skip_dynamic_types_for_structs)
+{
+ // For accessors, the dynamic types are already removed in the external signature itself.
+ char const* sourceCode = R"(
+ contract C {
+ struct S {
+ uint x;
+ string a; // this is present in the accessor
+ uint[] b; // this is not present
+ uint y;
+ }
+ S public s;
+ function g() returns (uint, uint) {
+ s.x = 2;
+ s.a = "abc";
+ s.b = [7, 8, 9];
+ s.y = 6;
+ var (x, a, y) = this.s();
+ return (x, y);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("g()") == encodeArgs(u256(2), u256(6)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}