mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Addressing issues with Enums in Solidity
This commit is contained in:
parent
afc328210e
commit
9dedbb4154
@ -1061,13 +1061,6 @@ BOOST_AUTO_TEST_CASE(enum_duplicate_values)
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
enum ActionChoices { GoLeft, GoRight, GoLeft, Sit };
|
||||
function test()
|
||||
{
|
||||
a = 1;
|
||||
b = 2;
|
||||
}
|
||||
uint256 a;
|
||||
uint64 b;
|
||||
}
|
||||
)";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
|
@ -703,14 +703,14 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression
|
||||
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(enum_declaration)
|
||||
BOOST_AUTO_TEST_CASE(enum_valid_declaration)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract c {
|
||||
enum foo { WARNING, NOTICE, ERROR, CRITICAL };
|
||||
enum validEnum { Value1, Value2, Value3, Value4 };
|
||||
function c ()
|
||||
{
|
||||
a = foo.CRITICAL;
|
||||
a = foo.Value3;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
@ -722,11 +722,6 @@ BOOST_AUTO_TEST_CASE(empty_enum_declaration)
|
||||
char const* text = R"(
|
||||
contract c {
|
||||
enum foo { };
|
||||
function c ()
|
||||
{
|
||||
a = 5;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||
}
|
||||
@ -736,11 +731,6 @@ BOOST_AUTO_TEST_CASE(malformed_enum_declaration)
|
||||
char const* text = R"(
|
||||
contract c {
|
||||
enum foo { WARNING,};
|
||||
function c ()
|
||||
{
|
||||
a = foo.CRITICAL;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user