test: add a test about accessing an enum member without the name of the enum

This commit is contained in:
Yoichi Hirai 2016-10-21 12:17:09 +02:00
parent 9d9380d30e
commit 4b7fdaa0bd
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -1439,6 +1439,21 @@ BOOST_AUTO_TEST_CASE(enum_invalid_member_access)
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)
{
char const* text = R"(