mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
- added isPartOfExternalInterface to Declaration
- changed position for the constant specifier. now it goes after type: <type> <constant> <name> = <value> - removed tests for constant functions, checkings for constant function doesn't belong to this story
This commit is contained in:
parent
2ca23b2247
commit
8e6b2c10c3
@ -3212,7 +3212,7 @@ BOOST_AUTO_TEST_CASE(const_state_variable)
|
||||
char const* sourceCode = R"(
|
||||
contract Foo {
|
||||
function getX() constant returns (uint r) { return x; }
|
||||
constant uint x = 56;
|
||||
uint constant x = 56;
|
||||
})";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("getX()") == encodeArgs(56));
|
||||
|
@ -1404,22 +1404,12 @@ BOOST_AUTO_TEST_CASE(test_byte_is_alias_of_byte1)
|
||||
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Type resolving failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(constant_function_editing_state_variable)
|
||||
BOOST_AUTO_TEST_CASE(const_state_variable)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract Foo {
|
||||
uint x = 56;
|
||||
function editIt() constant { x = 2; }
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(constant_function_editing_const_state_variable)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract Foo {
|
||||
constant uint x = 56;
|
||||
function editIt() constant { x = 2; }
|
||||
function changeIt() { x = 9; }
|
||||
uint constant x = 56;
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
@ -1404,25 +1404,15 @@ BOOST_AUTO_TEST_CASE(test_byte_is_alias_of_byte1)
|
||||
})";
|
||||
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Type resolving failed");
|
||||
=======
|
||||
BOOST_AUTO_TEST_CASE(constant_function_editing_state_variable)
|
||||
BOOST_AUTO_TEST_CASE(const_state_variable)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract Foo {
|
||||
uint x = 56;
|
||||
function editIt() constant { x = 2; }
|
||||
function changeIt() { x = 9; }
|
||||
uint constant x = 56;
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(constant_function_editing_const_state_variable)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract Foo {
|
||||
constant uint x = 56;
|
||||
function editIt() constant { x = 2; }
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
>>>>>>> 0925feb... added parsing for constant variables
|
||||
>>>>>>> 936dfba... one more test to check assigning the value to constant variable
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user