mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Changes deprecation and adjusts tests.
This commit is contained in:
committed by
Alex Beregszaszi
parent
bddfa47e77
commit
2c56e53046
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user