aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-04 04:48:53 +0800
committerchriseth <c@ethdev.com>2016-05-04 04:48:53 +0800
commite6b6e27bd7e7df459b8a626b38429673f5bdc5dd (patch)
tree77ccd39e769dc701decec277c21c276d21dd51d6 /test/libsolidity/SolidityEndToEndTest.cpp
parent7ea3d950d7001c12567c99aebdfc0fb73e46721e (diff)
downloaddexon-solidity-e6b6e27bd7e7df459b8a626b38429673f5bdc5dd.tar.gz
dexon-solidity-e6b6e27bd7e7df459b8a626b38429673f5bdc5dd.tar.zst
dexon-solidity-e6b6e27bd7e7df459b8a626b38429673f5bdc5dd.zip
Some more tests.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 6233e25f..9df64cdc 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -6710,6 +6710,31 @@ BOOST_AUTO_TEST_CASE(internal_library_function_bound)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
}
+BOOST_AUTO_TEST_CASE(internal_library_function_return_var_size)
+{
+ char const* sourceCode = R"(
+ library L {
+ struct S { uint[] data; }
+ function f(S _s) internal returns (uint[]) {
+ _s.data[3] = 2;
+ return _s.data;
+ }
+ }
+ contract C {
+ using L for L.S;
+ function f() returns (uint) {
+ L.S memory x;
+ x.data = new uint[](7);
+ x.data[3] = 8;
+ return x.f()[3];
+ }
+ }
+ )";
+ // This has to work without linking, because everything will be inlined.
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}