From c99f8fa4ea952e1f52f3acd95923dd18202a248e Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Sun, 1 Mar 2015 11:43:42 +0800 Subject: [PATCH] add several var related test cases --- test/SolidityParser.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/SolidityParser.cpp b/test/SolidityParser.cpp index 75eba8bc6..28221cc62 100644 --- a/test/SolidityParser.cpp +++ b/test/SolidityParser.cpp @@ -367,6 +367,40 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization) BOOST_CHECK_NO_THROW(parseText(text)); } +BOOST_AUTO_TEST_CASE(variable_definition_in_function_parameter) +{ + char const* text = R"( + contract test { + function fun(var a) {} + } + )"; + BOOST_CHECK_THROW(parseText(text), ParserError); +} + +BOOST_AUTO_TEST_CASE(variable_definition_in_mapping) +{ + char const* text = R"( + contract test { + function fun() { + mapping(var=>hash) d; + } + } + )"; + BOOST_CHECK_THROW(parseText(text), ParserError); +} + +BOOST_AUTO_TEST_CASE(variable_definition_in_function_return) +{ + char const* text = R"( + contract test { + function fun() returns(var d) { + return 1; + } + } + )"; + BOOST_CHECK_THROW(parseText(text), ParserError); +} + BOOST_AUTO_TEST_CASE(operator_expression) { char const* text = "contract test {\n"