- 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:
Liana Husikyan 2015-03-12 14:15:04 +01:00
parent 2ca23b2247
commit 8e6b2c10c3
3 changed files with 8 additions and 28 deletions

View File

@ -3212,7 +3212,7 @@ BOOST_AUTO_TEST_CASE(const_state_variable)
char const* sourceCode = R"( char const* sourceCode = R"(
contract Foo { contract Foo {
function getX() constant returns (uint r) { return x; } function getX() constant returns (uint r) { return x; }
constant uint x = 56; uint constant x = 56;
})"; })";
compileAndRun(sourceCode); compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("getX()") == encodeArgs(56)); BOOST_CHECK(callContractFunction("getX()") == encodeArgs(56));

View File

@ -1404,22 +1404,12 @@ BOOST_AUTO_TEST_CASE(test_byte_is_alias_of_byte1)
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Type resolving failed"); 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"( char const* text = R"(
contract Foo { contract Foo {
uint x = 56; function changeIt() { x = 9; }
function editIt() constant { x = 2; } 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); BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
} }

View File

@ -1404,25 +1404,15 @@ BOOST_AUTO_TEST_CASE(test_byte_is_alias_of_byte1)
})"; })";
ETH_TEST_REQUIRE_NO_THROW(parseTextAndResolveNames(text), "Type resolving failed"); 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"( char const* text = R"(
contract Foo { contract Foo {
uint x = 56; function changeIt() { x = 9; }
function editIt() constant { x = 2; } uint constant x = 56;
})"; })";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
} >>>>>>> 936dfba... one more test to check assigning the value to constant variable
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
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()