aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-14 23:32:13 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:17 +0800
commitab3d1b024db6e208e4b63e2ecb07754af1540d6f (patch)
tree0aa0fdb5050e6426ef2e10dacb6dada0ba00f29c /test/libsolidity/SolidityEndToEndTest.cpp
parent95d7555e3c0e8fc4826114a336e0e717fe7a1a2d (diff)
downloaddexon-solidity-ab3d1b024db6e208e4b63e2ecb07754af1540d6f.tar.gz
dexon-solidity-ab3d1b024db6e208e4b63e2ecb07754af1540d6f.tar.zst
dexon-solidity-ab3d1b024db6e208e4b63e2ecb07754af1540d6f.zip
Add tests around calling functions returning functions returning functions
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index b1529f8f..79dfd90e 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -7721,6 +7721,36 @@ BOOST_AUTO_TEST_CASE(function_type_library_internal)
}
+BOOST_AUTO_TEST_CASE(call_function_returning_function)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f0() returns (uint) {
+ return 2;
+ }
+ function f1() returns (function() returns (uint)) {
+ returns f0;
+ }
+ function f2() returns (function() returns (function () returns (uint))) {
+ returns f1;
+ }
+ function f3() returns (function() returns (function () returns (function () returns (uint))))
+ {
+ returns f2;
+ }
+ function f() returns (uint) {
+ function() returns(function() returns(function() returns(function() returns(uint)))) x;
+ x = f3;
+ return x()()()();
+ }
+ }
+ )";
+
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
+}
+
+
// TODO: arrays, libraries with external functions
BOOST_AUTO_TEST_CASE(shift_constant_left)