diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-03-01 11:43:42 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2015-03-01 11:43:42 +0800 |
commit | d00bad94d74625bc1996de5a4d7b9c17168ec83c (patch) | |
tree | 0a4324fb5d1f63787148852fbe45c10a1c79e2c9 | |
parent | 157f93898ae57cff875beb6549314bcb4ac66cdf (diff) | |
download | dexon-solidity-d00bad94d74625bc1996de5a4d7b9c17168ec83c.tar.gz dexon-solidity-d00bad94d74625bc1996de5a4d7b9c17168ec83c.tar.zst dexon-solidity-d00bad94d74625bc1996de5a4d7b9c17168ec83c.zip |
add several var related test cases
-rw-r--r-- | SolidityParser.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SolidityParser.cpp b/SolidityParser.cpp index 75eba8bc..28221cc6 100644 --- a/SolidityParser.cpp +++ b/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" |