aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 87646737..e9667483 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -25,8 +25,8 @@
#include <test/Options.h>
-#include <libsolidity/interface/Exceptions.h>
-#include <libsolidity/interface/EVMVersion.h>
+#include <liblangutil/Exceptions.h>
+#include <liblangutil/EVMVersion.h>
#include <libevmasm/Assembly.h>
@@ -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"(
@@ -14043,6 +14062,21 @@ BOOST_AUTO_TEST_CASE(flipping_sign_tests)
ABI_CHECK(callContractFunction("f()"), encodeArgs(true));
}
+BOOST_AUTO_TEST_CASE(external_public_override)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function f() external returns (uint) { return 1; }
+ }
+ contract B is A {
+ function f() public returns (uint) { return 2; }
+ function g() public returns (uint) { return f(); }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs(2));
+ ABI_CHECK(callContractFunction("g()"), encodeArgs(2));
+}
BOOST_AUTO_TEST_SUITE_END()
}