aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-15 06:52:07 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:19 +0800
commitb3eeb5fcf9a8efe1fc2a715fbd1a03c421824d72 (patch)
tree91c04daf7f4370d0935a24a388a3e6ca7c233a39
parente1fec9b2877492658b079d3278a702310213fe2a (diff)
downloaddexon-solidity-b3eeb5fcf9a8efe1fc2a715fbd1a03c421824d72.tar.gz
dexon-solidity-b3eeb5fcf9a8efe1fc2a715fbd1a03c421824d72.tar.zst
dexon-solidity-b3eeb5fcf9a8efe1fc2a715fbd1a03c421824d72.zip
Some more tests.
-rw-r--r--test/libsolidity/ASTJSON.cpp14
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp9
2 files changed, 16 insertions, 7 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp
index 0180c4ac..fd7c21b8 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -205,10 +205,16 @@ BOOST_AUTO_TEST_CASE(function_type)
map<string, unsigned> sourceIndices;
sourceIndices["a"] = 1;
Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
- Json::Value event = astJson["children"][0]["children"][0];
- BOOST_CHECK_EQUAL(event["name"], "EventDefinition");
- BOOST_CHECK_EQUAL(event["attributes"]["name"], "E");
- BOOST_CHECK_EQUAL(event["src"], "13:10:1");
+ Json::Value fun = astJson["children"][0]["children"][0];
+ BOOST_CHECK_EQUAL(fun["name"], "FunctionDefinition");
+ 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)");
+ Json::Value funType = argument["children"][0];
+ BOOST_CHECK_EQUAL(funType["attributes"]["constant"], true);
+ BOOST_CHECK_EQUAL(funType["attributes"]["payable"], true);
+ BOOST_CHECK_EQUAL(funType["attributes"]["visibility"], "external");
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index f77ad5fc..5cabb7fa 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -707,7 +707,7 @@ BOOST_AUTO_TEST_CASE(function_type)
{
char const* sourceCode = R"(
contract test {
- function g(function(uint) external returns (uint)) {}
+ function g(function(uint) external returns (uint) x) {}
}
)";
@@ -715,8 +715,11 @@ BOOST_AUTO_TEST_CASE(function_type)
[
{
"constant" : false,
- "payable": true,
- "inputs": ["function"],
+ "payable": false,
+ "inputs": [{
+ "name": "x",
+ "type": "function"
+ }],
"name": "g",
"outputs": [],
"type" : "function"