aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/ASTJSON.cpp
diff options
context:
space:
mode:
authordjudjuu <julfaber@gmail.com>2017-06-05 21:04:15 +0800
committerdjudjuu <julfaber@gmail.com>2017-06-06 21:47:30 +0800
commitebdebc7c12d152bcf9c96274ecf7dea2e46e2541 (patch)
treedd43c4f2fa81eb24b414a46606855e1da2803d81 /test/libsolidity/ASTJSON.cpp
parentb011ddfae351c5a4883c88898390ea863be9a410 (diff)
downloaddexon-solidity-ebdebc7c12d152bcf9c96274ecf7dea2e46e2541.tar.gz
dexon-solidity-ebdebc7c12d152bcf9c96274ecf7dea2e46e2541.tar.zst
dexon-solidity-ebdebc7c12d152bcf9c96274ecf7dea2e46e2541.zip
new test case and indentation fix
Diffstat (limited to 'test/libsolidity/ASTJSON.cpp')
-rw-r--r--test/libsolidity/ASTJSON.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/ASTJSON.cpp b/test/libsolidity/ASTJSON.cpp
index 8a790347..4476f1ed 100644
--- a/test/libsolidity/ASTJSON.cpp
+++ b/test/libsolidity/ASTJSON.cpp
@@ -228,6 +228,28 @@ BOOST_AUTO_TEST_CASE(function_type)
BOOST_CHECK_EQUAL(funType["attributes"]["visibility"], "external");
}
+BOOST_AUTO_TEST_CASE(documentation)
+{
+ CompilerStack c;
+ c.addSource("a", "/**This contract is empty*/ contract C {}");
+ c.addSource("b",
+ "/**This contract is empty"
+ " and has a line-breaking comment.*/"
+ "contract C {}"
+ );
+ c.parseAndAnalyze();
+ map<string, unsigned> sourceIndices;
+ sourceIndices["a"] = 0;
+ sourceIndices["b"] = 1;
+ Json::Value astJsonA = ASTJsonConverter(true, sourceIndices).toJson(c.ast("a"));
+ Json::Value documentationA = astJsonA["children"][0]["attributes"]["documentation"];
+ BOOST_CHECK_EQUAL(documentationA, "This contract is empty");
+ Json::Value astJsonB = ASTJsonConverter(true, sourceIndices).toJson(c.ast("b"));
+ Json::Value documentationB = astJsonB["children"][0]["attributes"]["documentation"];
+ BOOST_CHECK_EQUAL(documentationB, "This contract is empty and has a line-breaking comment.");
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
}