mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
test: add a test about accessing an enum member without the name of the enum
This commit is contained in:
parent
9d9380d30e
commit
4b7fdaa0bd
@ -1439,6 +1439,21 @@ BOOST_AUTO_TEST_CASE(enum_invalid_member_access)
|
|||||||
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
|
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(enum_invalid_direct_member_access)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
choices = Sit;
|
||||||
|
}
|
||||||
|
ActionChoices choices;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK(expectError(text) == Error::Type::DeclarationError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay)
|
BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user