aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-10 21:21:40 +0800
committerGitHub <noreply@github.com>2018-10-10 21:21:40 +0800
commit4035c96a32897d91da877dfb84e78e11e12b1e30 (patch)
tree60a4ed632784ebc9f9f7abd8fd419f6c3a873a88 /test/libsolidity
parent06200b4b64c911ea2e0b12076e0fa02093dacbf8 (diff)
parent8a15058a217b6765aa5a5085b328edcb84694927 (diff)
downloaddexon-solidity-4035c96a32897d91da877dfb84e78e11e12b1e30.tar.gz
dexon-solidity-4035c96a32897d91da877dfb84e78e11e12b1e30.tar.zst
dexon-solidity-4035c96a32897d91da877dfb84e78e11e12b1e30.zip
Merge pull request #5184 from ethereum/viewFunctionDocs
Library view functions
Diffstat (limited to 'test/libsolidity')
-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 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