diff options
author | Alex Sinyagin <sinyagin.alexander@gmail.com> | 2016-08-16 23:38:24 +0800 |
---|---|---|
committer | Alex Sinyagin <sinyagin.alexander@gmail.com> | 2016-08-18 20:29:59 +0800 |
commit | 95832da16ea1577dd50e62212dd0ea620e2fcaeb (patch) | |
tree | 67c7c9eae1aafa4d1af252cabadddb29466a2622 /test/libsolidity | |
parent | a9e04217a4f22eb9869a7830ba8f33bd72f2e452 (diff) | |
download | dexon-solidity-95832da16ea1577dd50e62212dd0ea620e2fcaeb.tar.gz dexon-solidity-95832da16ea1577dd50e62212dd0ea620e2fcaeb.tar.zst dexon-solidity-95832da16ea1577dd50e62212dd0ea620e2fcaeb.zip |
Add ast json converter for EnumValue
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/ASTJSON.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp index 58b17dd8..1a9b6981 100644 --- a/test/libsolidity/ASTJSON.cpp +++ b/test/libsolidity/ASTJSON.cpp @@ -108,6 +108,23 @@ BOOST_AUTO_TEST_CASE(enum_definition) BOOST_CHECK_EQUAL(enumDefinition["src"], "13:9:1"); } +BOOST_AUTO_TEST_CASE(enum_value) +{ + CompilerStack c; + c.addSource("a", "contract C { enum E { A, B } }"); + 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["children"][0]["name"], "EnumValue"); + BOOST_CHECK_EQUAL(enumDefinition["children"][0]["attributes"]["name"], "A"); + BOOST_CHECK_EQUAL(enumDefinition["children"][0]["src"], "22:1:1"); + BOOST_CHECK_EQUAL(enumDefinition["children"][1]["name"], "EnumValue"); + BOOST_CHECK_EQUAL(enumDefinition["children"][1]["attributes"]["name"], "B"); + BOOST_CHECK_EQUAL(enumDefinition["children"][1]["src"], "25:1:1"); +} + BOOST_AUTO_TEST_SUITE_END() } |