aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/ViewPureChecker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/ViewPureChecker.cpp')
-rw-r--r--test/libsolidity/ViewPureChecker.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/libsolidity/ViewPureChecker.cpp b/test/libsolidity/ViewPureChecker.cpp
index bb5480b2..b7ea1efc 100644
--- a/test/libsolidity/ViewPureChecker.cpp
+++ b/test/libsolidity/ViewPureChecker.cpp
@@ -53,9 +53,12 @@ BOOST_AUTO_TEST_CASE(environment_access)
"tx.origin",
"tx.gasprice",
"this",
- "address(1).balance"
+ "address(1).balance",
};
- // ``block.blockhash`` and ``blockhash`` are tested seperately below because their usage will
+ if (dev::test::Options::get().evmVersion().hasStaticCall())
+ view.emplace_back("address(0x4242).staticcall(\"\")");
+
+ // ``block.blockhash`` and ``blockhash`` are tested separately below because their usage will
// produce warnings that can't be handled in a generic way.
vector<string> pure{
"msg.data",
@@ -95,6 +98,23 @@ BOOST_AUTO_TEST_CASE(environment_access)
);
}
+BOOST_AUTO_TEST_CASE(address_staticcall)
+{
+ string text = R"(
+ contract C {
+ function i() view public returns (bool) {
+ (bool success,) = address(0x4242).staticcall("");
+ return success;
+ }
+ }
+ )";
+ if (!dev::test::Options::get().evmVersion().hasStaticCall())
+ CHECK_ERROR(text, TypeError, "\"staticcall\" is not supported by the VM version.");
+ else
+ CHECK_SUCCESS_NO_WARNINGS(text);
+}
+
+
BOOST_AUTO_TEST_CASE(assembly_staticcall)
{
string text = R"(