aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-06-14 11:09:11 +0800
committerFederico Bond <federicobond@gmail.com>2017-06-14 11:15:27 +0800
commitfd8365df08aafc7ab7cfac5fa916d910343d0eb3 (patch)
tree9b7e9192a022bc203efe240aed453b4cc18689f6 /test/libsolidity
parentc99c1c76f7ce2963b1401b53676ca3bbb0eadbea (diff)
downloaddexon-solidity-fd8365df08aafc7ab7cfac5fa916d910343d0eb3.tar.gz
dexon-solidity-fd8365df08aafc7ab7cfac5fa916d910343d0eb3.tar.zst
dexon-solidity-fd8365df08aafc7ab7cfac5fa916d910343d0eb3.zip
Forbid trailing commas in named arguments
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityParser.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index 31dfada9..27231b9b 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -199,6 +199,17 @@ BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
CHECK_PARSE_ERROR(text, "Expected primary expression");
}
+BOOST_AUTO_TEST_CASE(trailing_comma_in_named_args)
+{
+ char const* text = R"(
+ contract test {
+ function a(uint a, uint b, uint c) returns (uint r) { r = a * 100 + b * 10 + c * 1; }
+ function b() returns (uint r) { r = a({a: 1, b: 2, c: 3, }); }
+ }
+ )";
+ CHECK_PARSE_ERROR(text, "Unexpected trailing comma");
+}
+
BOOST_AUTO_TEST_CASE(two_exact_functions)
{
char const* text = R"(