From 1c3a64026bde5c484410bd01440624be938caff2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 Jun 2016 19:03:05 +0200 Subject: Add a test for a struct accessor. --- test/libsolidity/SolidityEndToEndTest.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/libsolidity') 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() } -- cgit