diff options
Diffstat (limited to 'test/libsolidity/SolidityNameAndTypeResolution.cpp')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 579fb239..e4e7b8d8 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -8555,16 +8555,31 @@ BOOST_AUTO_TEST_CASE(require_visibility_specifiers) CHECK_ERROR(text, SyntaxError, "No visibility specified."); } -BOOST_AUTO_TEST_CASE(blockhash_not_available_in_block) +BOOST_AUTO_TEST_CASE(blockhash) { - char const* text = R"( - contract Test { - function a() public returns (bytes32) { - return block.blockhash(0); + char const* code = R"( + contract C { + function f() public view returns (bytes32) { + return block.blockhash(3); } } )"; - CHECK_ERROR(text, TypeError, "Member \"blockhash\" not found or not visible after argument-dependent lookup in block"); + CHECK_WARNING(code, "\"block.blockhash()\" has been deprecated in favor of \"blockhash()\""); + + code = R"( + contract C { + function f() public view returns (bytes32) { return blockhash(3); } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(code); + + code = R"( + pragma experimental "v0.5.0"; + contract C { + function f() public returns (bytes32) { return block.blockhash(3); } + } + )"; + CHECK_ERROR(code, TypeError, "\"block.blockhash()\" has been deprecated in favor of \"blockhash()\""); } BOOST_AUTO_TEST_SUITE_END() |