aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-16 22:09:01 +0800
committerchriseth <c@ethdev.com>2016-11-16 22:09:01 +0800
commit2c14a96820233809db4360b39f5f02039be5730a (patch)
treeee20fa35cbc19eddcddd1013e745b387e7371be3 /test/libsolidity
parent2defe4dcefb6f0e17d7f87231233ff637dad55a8 (diff)
downloaddexon-solidity-2c14a96820233809db4360b39f5f02039be5730a.tar.gz
dexon-solidity-2c14a96820233809db4360b39f5f02039be5730a.tar.zst
dexon-solidity-2c14a96820233809db4360b39f5f02039be5730a.zip
Some more assertions and style changes.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/ASTJSON.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp
index fd7c21b8..b88218e7 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -200,7 +200,10 @@ BOOST_AUTO_TEST_CASE(non_utf8)
BOOST_AUTO_TEST_CASE(function_type)
{
CompilerStack c;
- c.addSource("a", "contract C { function f(function() external payable constant returns (uint) x) {} }");
+ c.addSource("a",
+ "contract C { function f(function() external payable returns (uint) x) "
+ "returns (function() external constant returns (uint)) {} }"
+ );
c.parse();
map<string, unsigned> sourceIndices;
sourceIndices["a"] = 1;
@@ -210,11 +213,19 @@ BOOST_AUTO_TEST_CASE(function_type)
Json::Value argument = fun["children"][0]["children"][0];
BOOST_CHECK_EQUAL(argument["name"], "VariableDeclaration");
BOOST_CHECK_EQUAL(argument["attributes"]["name"], "x");
- BOOST_CHECK_EQUAL(argument["attributes"]["type"], "function () constant payable external returns (uint256)");
+ BOOST_CHECK_EQUAL(argument["attributes"]["type"], "function () payable external returns (uint256)");
Json::Value funType = argument["children"][0];
- BOOST_CHECK_EQUAL(funType["attributes"]["constant"], true);
+ BOOST_CHECK_EQUAL(funType["attributes"]["constant"], false);
BOOST_CHECK_EQUAL(funType["attributes"]["payable"], true);
BOOST_CHECK_EQUAL(funType["attributes"]["visibility"], "external");
+ Json::Value retval = fun["children"][1]["children"][0];
+ BOOST_CHECK_EQUAL(retval["name"], "VariableDeclaration");
+ BOOST_CHECK_EQUAL(retval["attributes"]["name"], "");
+ BOOST_CHECK_EQUAL(retval["attributes"]["type"], "function () constant external returns (uint256)");
+ funType = retval["children"][0];
+ BOOST_CHECK_EQUAL(funType["attributes"]["constant"], true);
+ BOOST_CHECK_EQUAL(funType["attributes"]["payable"], false);
+ BOOST_CHECK_EQUAL(funType["attributes"]["visibility"], "external");
}
BOOST_AUTO_TEST_SUITE_END()