aboutsummaryrefslogtreecommitdiffstats
path: root/solidityNatspecJSON.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2014-12-05 19:27:18 +0800
committerLefteris Karapetsas <lefteris@refu.co>2014-12-05 19:27:18 +0800
commit0c24dc096eac2720288967eb1c7b3c0e078d2bf1 (patch)
tree5de24247d533dec1c182c3904be48fcbc3b67c32 /solidityNatspecJSON.cpp
parent54f353da1002de55541704664ddc764c406979f3 (diff)
downloaddexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar.gz
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar.bz2
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar.lz
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar.xz
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.tar.zst
dexon-solidity-0c24dc096eac2720288967eb1c7b3c0e078d2bf1.zip
Newline right after doctag is now a valid natspec entry
- Plus tests for that
Diffstat (limited to 'solidityNatspecJSON.cpp')
-rw-r--r--solidityNatspecJSON.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/solidityNatspecJSON.cpp b/solidityNatspecJSON.cpp
index f2ae15c9..9596f2b8 100644
--- a/solidityNatspecJSON.cpp
+++ b/solidityNatspecJSON.cpp
@@ -192,6 +192,30 @@ BOOST_AUTO_TEST_CASE(dev_and_user_no_doc)
checkNatspec(sourceCode, userNatspec, true);
}
+BOOST_AUTO_TEST_CASE(dev_desc_after_nl)
+{
+ char const* sourceCode = "contract test {\n"
+ " /// @dev\n"
+ " /// Multiplies a number by 7 and adds second parameter\n"
+ " /// @param a Documentation for the first parameter\n"
+ " /// @param second Documentation for the second parameter\n"
+ " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n"
+ "}\n";
+
+ char const* natspec = "{"
+ "\"methods\":{"
+ " \"mul\":{ \n"
+ " \"details\": \" Multiplies a number by 7 and adds second parameter\",\n"
+ " \"params\": {\n"
+ " \"a\": \"Documentation for the first parameter\",\n"
+ " \"second\": \"Documentation for the second parameter\"\n"
+ " }\n"
+ " }\n"
+ "}}";
+
+ checkNatspec(sourceCode, natspec, false);
+}
+
BOOST_AUTO_TEST_CASE(dev_multiple_params)
{
char const* sourceCode = "contract test {\n"
@@ -314,6 +338,33 @@ BOOST_AUTO_TEST_CASE(dev_return)
checkNatspec(sourceCode, natspec, false);
}
+BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
+{
+ char const* sourceCode = "contract test {\n"
+ " /// @dev Multiplies a number by 7 and adds second parameter\n"
+ " /// @param a Documentation for the first parameter starts here.\n"
+ " /// Since it's a really complicated parameter we need 2 lines\n"
+ " /// @param second Documentation for the second parameter\n"
+ " /// @return\n"
+ " /// The result of the multiplication\n"
+ " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n"
+ "}\n";
+
+ char const* natspec = "{"
+ "\"methods\":{"
+ " \"mul\":{ \n"
+ " \"details\": \"Multiplies a number by 7 and adds second parameter\",\n"
+ " \"params\": {\n"
+ " \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
+ " \"second\": \"Documentation for the second parameter\"\n"
+ " },\n"
+ " \"return\": \" The result of the multiplication\"\n"
+ " }\n"
+ "}}";
+
+ checkNatspec(sourceCode, natspec, false);
+}
+
BOOST_AUTO_TEST_CASE(dev_multiline_return)
{