diff options
author | chriseth <chris@ethereum.org> | 2018-11-23 01:23:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 01:23:46 +0800 |
commit | ecd059cb9225c5b9d01a928b1495aff31e3773ee (patch) | |
tree | 7c182755c8fdac9eff202b54f6330dc39073829f /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | b0e4ef7a1325b160e225745264317c0046c39f71 (diff) | |
parent | 06189ae57f2f556f21499938fca8f9c0db82779e (diff) | |
download | dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar.gz dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar.bz2 dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar.lz dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar.xz dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.tar.zst dexon-solidity-ecd059cb9225c5b9d01a928b1495aff31e3773ee.zip |
Merge pull request #5451 from ethereum/bound_function_tests
Add assert and tests for bound functions
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 041f29a8..e591432a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9388,6 +9388,25 @@ BOOST_AUTO_TEST_CASE(using_for_by_name) ABI_CHECK(callContractFunction("x()"), encodeArgs(u256(6 * 7))); } +BOOST_AUTO_TEST_CASE(bound_function_in_function) +{ + char const* sourceCode = R"( + library L { + function g(function() internal returns (uint) _t) internal returns (uint) { return _t(); } + } + contract C { + using L for *; + function f() public returns (uint) { + return t.g(); + } + function t() public pure returns (uint) { return 7; } + } + )"; + compileAndRun(sourceCode, 0, "L"); + compileAndRun(sourceCode, 0, "C", bytes(), map<string, Address>{{"L", m_contractAddress}}); + ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(7))); +} + BOOST_AUTO_TEST_CASE(bound_function_in_var) { char const* sourceCode = R"( |