diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-15 21:36:05 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-08-15 22:06:48 +0800 |
commit | ed5265598baf629e2c36ae7d2f7d2913024fe4d8 (patch) | |
tree | e7d76fd9d0e18a881c945120d62cc29f179a788a /test/libsolidity | |
parent | 7ca0aaaf6f62aafd0fe36ae6b7dc777361ae40e3 (diff) | |
download | dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar.gz dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar.bz2 dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar.lz dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar.xz dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.tar.zst dexon-solidity-ed5265598baf629e2c36ae7d2f7d2913024fe4d8.zip |
Add view pure checker tests for ``address.staticcall(...)``.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/ViewPureChecker.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/libsolidity/ViewPureChecker.cpp b/test/libsolidity/ViewPureChecker.cpp index 299cd084..d993b92e 100644 --- a/test/libsolidity/ViewPureChecker.cpp +++ b/test/libsolidity/ViewPureChecker.cpp @@ -53,8 +53,11 @@ BOOST_AUTO_TEST_CASE(environment_access) "tx.origin", "tx.gasprice", "this", - "address(1).balance" + "address(1).balance", }; + 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{ @@ -95,6 +98,22 @@ BOOST_AUTO_TEST_CASE(environment_access) ); } +BOOST_AUTO_TEST_CASE(address_staticcall) +{ + string text = R"( + contract C { + function i() view public returns (bool) { + return address(0x4242).staticcall(""); + } + } + )"; + 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"( |