aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-09 22:53:00 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-11-12 00:48:03 +0800
commit4b6e7e0677c9d5de50258fab39ed62e48778ac7a (patch)
treeca082c85ee48992c511b17ba24baf478c8491b99 /test
parent0a6c937dcbb3671e2fa5f6d7b50b5a909cf522d0 (diff)
downloaddexon-solidity-4b6e7e0677c9d5de50258fab39ed62e48778ac7a.tar.gz
dexon-solidity-4b6e7e0677c9d5de50258fab39ed62e48778ac7a.tar.zst
dexon-solidity-4b6e7e0677c9d5de50258fab39ed62e48778ac7a.zip
test: add a test conerting an enum into another enum, which should fail
Diffstat (limited to 'test')
-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 099c3c00..f498a0b9 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -1535,6 +1535,21 @@ BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay)
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}
+BOOST_AUTO_TEST_CASE(enum_to_enum_conversion_is_not_okay)
+{
+ char const* text = R"(
+ contract test {
+ enum Paper { Up, Down, Left, Right }
+ enum Ground { North, South, West, East }
+ function test()
+ {
+ Ground(Paper.Up);
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text) == Error::Type::TypeError);
+}
+
BOOST_AUTO_TEST_CASE(enum_duplicate_values)
{
char const* text = R"(