aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-02-05 02:44:42 +0800
committerGav Wood <i@gavwood.com>2015-02-05 02:44:42 +0800
commit8b8097ec030e4cffcbd7e30487ba8581d46782b6 (patch)
treeeccf61036bf5e09533a0029f365357c50e6c9bc2
parent4dc5909072fd87f29716c0429ecdd40eddeedf5a (diff)
parent4833b45fb39c8acbd54a0c20f5fe01f908fcc266 (diff)
downloaddexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar.gz
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar.bz2
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar.lz
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar.xz
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.tar.zst
dexon-solidity-8b8097ec030e4cffcbd7e30487ba8581d46782b6.zip
Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop
Conflicts: mix/MixClient.cpp
-rw-r--r--SolidityNameAndTypeResolution.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp
index 1a087592..ae6c374b 100644
--- a/SolidityNameAndTypeResolution.cpp
+++ b/SolidityNameAndTypeResolution.cpp
@@ -868,6 +868,42 @@ BOOST_AUTO_TEST_CASE(access_to_protected_state_variable)
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
+BOOST_AUTO_TEST_CASE(error_count_in_named_args)
+{
+ char const* sourceCode = "contract test {\n"
+ " function a(uint a, uint b) returns (uint r) { r = a + b; }\n"
+ " function b() returns (uint r) { r = a({a: 1}); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
+BOOST_AUTO_TEST_CASE(empty_in_named_args)
+{
+ char const* sourceCode = "contract test {\n"
+ " function a(uint a, uint b) returns (uint r) { r = a + b; }\n"
+ " function b() returns (uint r) { r = a({}); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
+BOOST_AUTO_TEST_CASE(duplicate_parameter_names_in_named_args)
+{
+ char const* sourceCode = "contract test {\n"
+ " function a(uint a, uint b) returns (uint r) { r = a + b; }\n"
+ " function b() returns (uint r) { r = a({a: 1, a: 2}); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
+BOOST_AUTO_TEST_CASE(invalid_parameter_names_in_named_args)
+{
+ char const* sourceCode = "contract test {\n"
+ " function a(uint a, uint b) returns (uint r) { r = a + b; }\n"
+ " function b() returns (uint r) { r = a({a: 1, c: 2}); }\n"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}