From 850350e7bc7dc037fff617331056ffcb9504b96f Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 11 Feb 2015 17:23:13 +0100 Subject: [PATCH] Disallow trailing comma in Enum Declaration --- SolidityParser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SolidityParser.cpp b/SolidityParser.cpp index 291ec6051..07ec2dcfa 100644 --- a/SolidityParser.cpp +++ b/SolidityParser.cpp @@ -731,6 +731,20 @@ BOOST_AUTO_TEST_CASE(empty_enum_declaration) BOOST_CHECK_NO_THROW(parseTextExplainError(text)); } +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); +} + BOOST_AUTO_TEST_SUITE_END() }