diff options
author | chriseth <c@ethdev.com> | 2016-09-15 23:44:32 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-09-17 17:29:27 +0800 |
commit | 727c6fac85cb5f752525b9f2312707755577162f (patch) | |
tree | 2948f0cf1215c89a58ada6b7fcd95b3aeb6d9480 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 0bc8476aeaac94f44d85d72865c142ac4151967f (diff) | |
download | dexon-solidity-727c6fac85cb5f752525b9f2312707755577162f.tar.gz dexon-solidity-727c6fac85cb5f752525b9f2312707755577162f.tar.zst dexon-solidity-727c6fac85cb5f752525b9f2312707755577162f.zip |
Allow value transfer to library functions.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 7ee5700c..3c949e9a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7144,6 +7144,23 @@ BOOST_AUTO_TEST_CASE(payable_function) BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 27 + 27); } +BOOST_AUTO_TEST_CASE(payable_function_calls_library) +{ + char const* sourceCode = R"( + library L { + function f() returns (uint) { return 7; } + } + contract C { + function f() payable returns (uint) { + return L.f(); + } + } + )"; + compileAndRun(sourceCode, 0, "L"); + compileAndRun(sourceCode, 0, "C", bytes(), map<string, Address>{{"L", m_contractAddress}}); + BOOST_CHECK(callContractFunctionWithValue("f()", 27) == encodeArgs(u256(7))); +} + BOOST_AUTO_TEST_CASE(non_payable_throw) { char const* sourceCode = R"( |