mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Correcting and testing enum member access
This commit is contained in:
parent
60e839954e
commit
d8535eb4ea
@ -991,11 +991,11 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big)
|
|||||||
})";
|
})";
|
||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(enum_member_access)
|
BOOST_AUTO_TEST_CASE(enum_member_access)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract test {
|
contract test {
|
||||||
struct foo { uint256 x;}
|
|
||||||
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit };
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit };
|
||||||
function test()
|
function test()
|
||||||
{
|
{
|
||||||
@ -1007,6 +1007,21 @@ BOOST_AUTO_TEST_CASE(enum_member_access)
|
|||||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_invalid_member_access)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit };
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
choices = ActionChoices.RunAroundWavingYourHands;
|
||||||
|
}
|
||||||
|
ActionChoices choices;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user