mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust tests for multiple errors with the var keyword
This commit is contained in:
parent
3ddbf1617f
commit
573aa01fd2
@ -1844,7 +1844,10 @@ BOOST_AUTO_TEST_CASE(warn_var_from_zero)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_WARNING(sourceCode, "uint8, which can hold values between 0 and 255");
|
CHECK_WARNING_ALLOW_MULTI(sourceCode, (std::vector<std::string>{
|
||||||
|
"uint8, which can hold values between 0 and 255",
|
||||||
|
"Use of the \"var\" keyword is deprecated."
|
||||||
|
}));
|
||||||
sourceCode = R"(
|
sourceCode = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() pure public {
|
function f() pure public {
|
||||||
@ -1853,7 +1856,10 @@ BOOST_AUTO_TEST_CASE(warn_var_from_zero)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_WARNING(sourceCode, "uint256, which can hold values between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935");
|
CHECK_WARNING_ALLOW_MULTI(sourceCode, (std::vector<std::string>{
|
||||||
|
"uint256, which can hold values between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935",
|
||||||
|
"Use of the \"var\" keyword is deprecated."
|
||||||
|
}));
|
||||||
sourceCode = R"(
|
sourceCode = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() pure public {
|
function f() pure public {
|
||||||
@ -1862,7 +1868,10 @@ BOOST_AUTO_TEST_CASE(warn_var_from_zero)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_WARNING(sourceCode, "int8, which can hold values between -128 and 127");
|
CHECK_WARNING_ALLOW_MULTI(sourceCode, (std::vector<std::string>{
|
||||||
|
"int8, which can hold values between -128 and 127",
|
||||||
|
"Use of the \"var\" keyword is deprecated."
|
||||||
|
}));
|
||||||
sourceCode = R"(
|
sourceCode = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() pure public {
|
function f() pure public {
|
||||||
@ -1870,7 +1879,10 @@ BOOST_AUTO_TEST_CASE(warn_var_from_zero)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_WARNING(sourceCode, "uint8, which can hold");
|
CHECK_WARNING_ALLOW_MULTI(sourceCode, (std::vector<std::string>{
|
||||||
|
"uint8, which can hold",
|
||||||
|
"Use of the \"var\" keyword is deprecated."
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(enum_member_access)
|
BOOST_AUTO_TEST_CASE(enum_member_access)
|
||||||
@ -4887,8 +4899,7 @@ BOOST_AUTO_TEST_CASE(warn_about_callcode)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() pure public {
|
function f() pure public {
|
||||||
var x = address(0x12).callcode;
|
address(0x12).callcode;
|
||||||
x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
@ -4897,8 +4908,7 @@ BOOST_AUTO_TEST_CASE(warn_about_callcode)
|
|||||||
pragma experimental "v0.5.0";
|
pragma experimental "v0.5.0";
|
||||||
contract test {
|
contract test {
|
||||||
function f() pure public {
|
function f() pure public {
|
||||||
var x = address(0x12).callcode;
|
address(0x12).callcode;
|
||||||
x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
@ -6918,7 +6928,7 @@ BOOST_AUTO_TEST_CASE(function_types_sig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
CHECK_WARNING(text, "Use of the \"var\" keyword is deprecated.");
|
||||||
text = R"(
|
text = R"(
|
||||||
contract C {
|
contract C {
|
||||||
function h() pure external {
|
function h() pure external {
|
||||||
@ -6941,7 +6951,7 @@ BOOST_AUTO_TEST_CASE(function_types_sig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
CHECK_WARNING(text, "Use of the \"var\" keyword is deprecated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(using_this_in_constructor)
|
BOOST_AUTO_TEST_CASE(using_this_in_constructor)
|
||||||
|
@ -136,10 +136,12 @@ BOOST_AUTO_TEST_CASE(environment_access)
|
|||||||
}
|
}
|
||||||
for (string const& x: pure)
|
for (string const& x: pure)
|
||||||
{
|
{
|
||||||
CHECK_WARNING(
|
CHECK_WARNING_ALLOW_MULTI(
|
||||||
"contract C { function f() view public { var x = " + x + "; x; } }",
|
"contract C { function f() view public { var x = " + x + "; x; } }",
|
||||||
"restricted to pure"
|
(std::vector<std::string>{
|
||||||
);
|
"Function state mutability can be restricted to pure",
|
||||||
|
"Use of the \"var\" keyword is deprecated."
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user