aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-02-05 00:06:54 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2015-02-05 00:36:04 +0800
commitbade3d98e91fe3e3a20dafba61a975a5638554b7 (patch)
treecb33b547625d6ddacfdebb42cf265bca1432082d
parent9f5d8342a6e89117a0f72e89ecf7f6ed2f7d26b9 (diff)
downloaddexon-solidity-bade3d98e91fe3e3a20dafba61a975a5638554b7.tar.gz
dexon-solidity-bade3d98e91fe3e3a20dafba61a975a5638554b7.tar.zst
dexon-solidity-bade3d98e91fe3e3a20dafba61a975a5638554b7.zip
add two test cases parser error for named args
-rw-r--r--SolidityParser.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/SolidityParser.cpp b/SolidityParser.cpp
index 4ccdcd57..9ba38a4a 100644
--- a/SolidityParser.cpp
+++ b/SolidityParser.cpp
@@ -124,6 +124,24 @@ BOOST_AUTO_TEST_CASE(single_function_param)
BOOST_CHECK_NO_THROW(parseText(text));
}
+BOOST_AUTO_TEST_CASE(missing_parameter_name_in_named_args)
+{
+ char const* text = "contract test {\n"
+ " function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; }\n"
+ " function b() returns (uint r) { r = a({: 1, : 2, : 3}); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
+BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
+{
+ char const* text = "contract test {\n"
+ " function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; }\n"
+ " function b() returns (uint r) { r = a({a: , b: , c: }); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
{
ASTPointer<ContractDefinition> contract;