aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-17 22:23:20 +0800
committerAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-18 20:29:59 +0800
commita5d15e6895212a034f459ba06fe0ca62ba5c0904 (patch)
treed7935ea400a8a297c27cc8b8cebc8a71c8c072f6 /test/libsolidity
parent95832da16ea1577dd50e62212dd0ea620e2fcaeb (diff)
downloaddexon-solidity-a5d15e6895212a034f459ba06fe0ca62ba5c0904.tar.gz
dexon-solidity-a5d15e6895212a034f459ba06fe0ca62ba5c0904.tar.zst
dexon-solidity-a5d15e6895212a034f459ba06fe0ca62ba5c0904.zip
Add ast json converter for ModifierDefinition
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/ASTJSON.cpp14
1 files changed, 14 insertions, 0 deletions
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<string, unsigned> 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()
}