mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some more tests.
This commit is contained in:
parent
e1fec9b287
commit
b3eeb5fcf9
@ -205,10 +205,16 @@ BOOST_AUTO_TEST_CASE(function_type)
|
|||||||
map<string, unsigned> sourceIndices;
|
map<string, unsigned> sourceIndices;
|
||||||
sourceIndices["a"] = 1;
|
sourceIndices["a"] = 1;
|
||||||
Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
|
Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
|
||||||
Json::Value event = astJson["children"][0]["children"][0];
|
Json::Value fun = astJson["children"][0]["children"][0];
|
||||||
BOOST_CHECK_EQUAL(event["name"], "EventDefinition");
|
BOOST_CHECK_EQUAL(fun["name"], "FunctionDefinition");
|
||||||
BOOST_CHECK_EQUAL(event["attributes"]["name"], "E");
|
Json::Value argument = fun["children"][0]["children"][0];
|
||||||
BOOST_CHECK_EQUAL(event["src"], "13:10:1");
|
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()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -707,7 +707,7 @@ BOOST_AUTO_TEST_CASE(function_type)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract test {
|
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,
|
"constant" : false,
|
||||||
"payable": true,
|
"payable": false,
|
||||||
"inputs": ["function"],
|
"inputs": [{
|
||||||
|
"name": "x",
|
||||||
|
"type": "function"
|
||||||
|
}],
|
||||||
"name": "g",
|
"name": "g",
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"type" : "function"
|
"type" : "function"
|
||||||
|
Loading…
Reference in New Issue
Block a user