Changes deprecation and adjusts tests.

This commit is contained in:
bitshift
2018-03-27 03:30:03 +01:00
committed by Alex Beregszaszi
parent bddfa47e77
commit 2c56e53046
5 changed files with 76 additions and 59 deletions
@@ -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()