diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-12 22:19:04 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-14 06:16:14 +0800 |
commit | d8535eb4ea322e3d5a9f69c953fd22a1ae3f5d8d (patch) | |
tree | 51019b7987a3aecf5d0efaa8a2b9567d5ede0c56 | |
parent | 60e839954ed2816f5b138e1bab618ebd58ad87ed (diff) | |
download | dexon-solidity-d8535eb4ea322e3d5a9f69c953fd22a1ae3f5d8d.tar.gz dexon-solidity-d8535eb4ea322e3d5a9f69c953fd22a1ae3f5d8d.tar.zst dexon-solidity-d8535eb4ea322e3d5a9f69c953fd22a1ae3f5d8d.zip |
Correcting and testing enum member access
-rw-r--r-- | SolidityNameAndTypeResolution.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 490ab3be..34f51a4c 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -991,11 +991,11 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big) })"; BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); } + BOOST_AUTO_TEST_CASE(enum_member_access) { char const* text = R"( contract test { - struct foo { uint256 x;} enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }; function test() { @@ -1007,6 +1007,21 @@ BOOST_AUTO_TEST_CASE(enum_member_access) 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() } |