From a5d15e6895212a034f459ba06fe0ca62ba5c0904 Mon Sep 17 00:00:00 2001 From: Alex Sinyagin Date: Wed, 17 Aug 2016 14:23:20 +0000 Subject: Add ast json converter for ModifierDefinition --- test/libsolidity/ASTJSON.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/libsolidity/ASTJSON.cpp') diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp index 1a9b6981..04733055 100644 --- a/test/libsolidity/ASTJSON.cpp +++ b/test/libsolidity/ASTJSON.cpp @@ -125,6 +125,20 @@ BOOST_AUTO_TEST_CASE(enum_value) BOOST_CHECK_EQUAL(enumDefinition["children"][1]["src"], "25:1:1"); } +BOOST_AUTO_TEST_CASE(modifier_definition) +{ + CompilerStack c; + c.addSource("a", "contract C { modifier M(uint i) { _ } function F() M(1) {} }"); + c.parse(); + map sourceIndices; + sourceIndices["a"] = 1; + Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json(); + Json::Value modifier = astJson["children"][0]["children"][0]; + BOOST_CHECK_EQUAL(modifier["name"], "ModifierDefinition"); + BOOST_CHECK_EQUAL(modifier["attributes"]["name"], "M"); + BOOST_CHECK_EQUAL(modifier["src"], "13:24:1"); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit