test: add a test case for accessing a state variable under the contract's name

The test comes from the description of #988
This commit is contained in:
Yoichi Hirai 2016-10-21 12:22:08 +02:00
parent 22f2c6df63
commit 47b11ef2b8
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -5666,6 +5666,21 @@ BOOST_AUTO_TEST_CASE(accessor_for_const_state_variable)
BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(555)));
}
BOOST_AUTO_TEST_CASE(state_variable_under_contract_name)
{
char const* text = R"(
contract Scope {
uint stateVar = 42;
function getStateVar() constant returns (uint stateVar) {
stateVar = Scope.stateVar;
}
}
)";
compileAndRun(text);
BOOST_CHECK(callContractFunction("getStateVar()") == encodeArgs(u256(42)));
}
BOOST_AUTO_TEST_CASE(constant_string_literal)
{
char const* sourceCode = R"(