diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-10-10 18:28:24 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-10-10 18:28:24 +0800 |
commit | 4beabf6686c59fbe4ac6d4a4a158eca41a0b682a (patch) | |
tree | 0f0e149f1d68864f80247aa65ca594198cb79234 /test | |
parent | 7d2dc14304e2ce1805069eef57904805ed6b96eb (diff) | |
download | dexon-solidity-4beabf6686c59fbe4ac6d4a4a158eca41a0b682a.tar.gz dexon-solidity-4beabf6686c59fbe4ac6d4a4a158eca41a0b682a.tar.zst dexon-solidity-4beabf6686c59fbe4ac6d4a4a158eca41a0b682a.zip |
Documents library view functions and adds unit test.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f65c8b27..7a496e64 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4519,6 +4519,31 @@ BOOST_AUTO_TEST_CASE(library_call_protection) ABI_CHECK(callContractFunction("pu()"), encodeArgs(2)); } + +BOOST_AUTO_TEST_CASE(library_staticcall_delegatecall) +{ + char const* sourceCode = R"( + library Lib { + function x() public view returns (uint) { + return 1; + } + } + contract Test { + uint t; + function f() public returns (uint) { + t = 2; + return this.g(); + } + function g() public view returns (uint) { + return Lib.x(); + } + } + )"; + compileAndRun(sourceCode, 0, "Lib"); + compileAndRun(sourceCode, 0, "Test", bytes(), map<string, Address>{{"Lib", m_contractAddress}}); + ABI_CHECK(callContractFunction("f()"), encodeArgs(1)); +} + BOOST_AUTO_TEST_CASE(store_bytes) { // this test just checks that the copy loop does not mess up the stack |