From 2c14a96820233809db4360b39f5f02039be5730a Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 16 Nov 2016 15:09:01 +0100 Subject: Some more assertions and style changes. --- test/libsolidity/ASTJSON.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'test/libsolidity/ASTJSON.cpp') 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 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() -- cgit