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"(
|
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));
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user