aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-16 21:25:25 +0800
committerAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-18 20:29:59 +0800
commit9e7fc124633ae1503ab33f1842f0164d895f46d2 (patch)
tree04dea677628aab5f3463baceb3e278cc29eece07 /test
parentc282ab379aac4a6b14f59a957c6261e2edb8b1ce (diff)
downloaddexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar.gz
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar.bz2
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar.lz
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar.xz
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.tar.zst
dexon-solidity-9e7fc124633ae1503ab33f1842f0164d895f46d2.zip
Add a ast json converter for InheritanceSpecifier
Diffstat (limited to 'test')
-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 6d914391..997e0fe8 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -62,6 +62,20 @@ BOOST_AUTO_TEST_CASE(source_location)
BOOST_CHECK_EQUAL(astJson["children"][0]["children"][0]["src"], "13:32:1");
}
+BOOST_AUTO_TEST_CASE(inheritance_specifier)
+{
+ CompilerStack c;
+ c.addSource("a", "contract C1 {} contract C2 is C1 {}");
+ c.parse();
+ map<string, unsigned> sourceIndices;
+ sourceIndices["a"] = 1;
+ Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
+ BOOST_CHECK_EQUAL(astJson["children"][1]["attributes"]["name"], "C2");
+ BOOST_CHECK_EQUAL(astJson["children"][1]["children"][0]["name"], "Inheritance");
+ BOOST_CHECK_EQUAL(astJson["children"][1]["children"][0]["children"][0]["name"], "UserDefinedTypeName");
+ BOOST_CHECK_EQUAL(astJson["children"][1]["children"][0]["children"][0]["attributes"]["name"], "C1");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}