aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-16 22:28:28 +0800
committerAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-18 20:29:59 +0800
commit40ca2c9e977b98083efed96f031c298cf65d0893 (patch)
tree42646ca2a65f39e49b1cfba01787b3a167eb2086 /test
parent9e7fc124633ae1503ab33f1842f0164d895f46d2 (diff)
downloaddexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar.gz
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar.bz2
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar.lz
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar.xz
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.tar.zst
dexon-solidity-40ca2c9e977b98083efed96f031c298cf65d0893.zip
Add ast json converter for UsingForDirective
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/ASTJSON.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp
index 997e0fe8..c252b133 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -76,6 +76,23 @@ BOOST_AUTO_TEST_CASE(inheritance_specifier)
BOOST_CHECK_EQUAL(astJson["children"][1]["children"][0]["children"][0]["attributes"]["name"], "C1");
}
+BOOST_AUTO_TEST_CASE(using_for_directive)
+{
+ CompilerStack c;
+ c.addSource("a", "library L {} contract C { using L for uint; }");
+ c.parse();
+ map<string, unsigned> sourceIndices;
+ sourceIndices["a"] = 1;
+ Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
+ Json::Value usingFor = astJson["children"][1]["children"][0];
+ BOOST_CHECK_EQUAL(usingFor["name"], "UsingFor");
+ BOOST_CHECK_EQUAL(usingFor["src"], "26:17:1");
+ BOOST_CHECK_EQUAL(usingFor["children"][0]["name"], "UserDefinedTypeName");
+ BOOST_CHECK_EQUAL(usingFor["children"][0]["attributes"]["name"], "L");
+ BOOST_CHECK_EQUAL(usingFor["children"][1]["name"], "ElementaryTypeName");
+ BOOST_CHECK_EQUAL(usingFor["children"][1]["attributes"]["name"], "uint");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}