aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-21 18:17:09 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-21 19:01:45 +0800
commit4b7fdaa0bd75775d7a17f809c6ac33def5a6b523 (patch)
treeaeecfbc9d8be123a1f9789b1254d1a3727a53320 /test/libsolidity
parent9d9380d30ededcd29ad31c93f857ec7fa149f4a3 (diff)
downloaddexon-solidity-4b7fdaa0bd75775d7a17f809c6ac33def5a6b523.tar.gz
dexon-solidity-4b7fdaa0bd75775d7a17f809c6ac33def5a6b523.tar.zst
dexon-solidity-4b7fdaa0bd75775d7a17f809c6ac33def5a6b523.zip
test: add a test about accessing an enum member without the name of the enum
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index c580e491..74632860 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -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"(