aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-16 23:18:57 +0800
committerAlex Sinyagin <sinyagin.alexander@gmail.com>2016-08-18 20:29:59 +0800
commita9e04217a4f22eb9869a7830ba8f33bd72f2e452 (patch)
tree87e5081f0e78cb95ffbd39b063b403b303b70df8 /test
parentaf64219e17f2a01c1a27e19873ab6b03bfd01bfd (diff)
downloaddexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar.gz
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar.bz2
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar.lz
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar.xz
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.tar.zst
dexon-solidity-a9e04217a4f22eb9869a7830ba8f33bd72f2e452.zip
Add ast json converter for EnumDefinition
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 2dcdf0b4..58b17dd8 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -94,6 +94,20 @@ BOOST_AUTO_TEST_CASE(using_for_directive)
BOOST_CHECK_EQUAL(usingFor["children"][1]["attributes"]["name"], "uint");
}
+BOOST_AUTO_TEST_CASE(enum_definition)
+{
+ CompilerStack c;
+ c.addSource("a", "contract C { enum E {} }");
+ c.parse();
+ map<string, unsigned> sourceIndices;
+ sourceIndices["a"] = 1;
+ Json::Value astJson = ASTJsonConverter(c.ast("a"), sourceIndices).json();
+ Json::Value enumDefinition = astJson["children"][0]["children"][0];
+ BOOST_CHECK_EQUAL(enumDefinition["name"], "Enum");
+ BOOST_CHECK_EQUAL(enumDefinition["attributes"]["name"], "E");
+ BOOST_CHECK_EQUAL(enumDefinition["src"], "13:9:1");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}