aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-30 21:14:59 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-30 21:14:59 +0800
commitd82a3ca956c0db1061df92c04220e935b6fa58d1 (patch)
treee2139629cc4bb40e4ed72e5120642a9f243836d6
parent735c02c468de32b4f91c59794039b67ab29a8170 (diff)
downloaddexon-solidity-d82a3ca956c0db1061df92c04220e935b6fa58d1.tar.gz
dexon-solidity-d82a3ca956c0db1061df92c04220e935b6fa58d1.tar.zst
dexon-solidity-d82a3ca956c0db1061df92c04220e935b6fa58d1.zip
Detect if non-existant parameter is documented with natspec
-rw-r--r--SolidityNatspecJSON.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp
index edfe8986..4e6c9855 100644
--- a/SolidityNatspecJSON.cpp
+++ b/SolidityNatspecJSON.cpp
@@ -176,7 +176,6 @@ BOOST_AUTO_TEST_CASE(dev_and_user_no_doc)
"}\n";
char const* devNatspec = "{\"methods\":{}}";
-
char const* userNatspec = "{\"methods\":{}}";
checkNatspec(sourceCode, devNatspec, false);
@@ -230,6 +229,18 @@ BOOST_AUTO_TEST_CASE(dev_multiple_params)
checkNatspec(sourceCode, natspec, false);
}
+BOOST_AUTO_TEST_CASE(dev_documenting_nonexistant_param)
+{
+ char const* sourceCode = "contract test {\n"
+ " /// @dev Multiplies a number by 7 and adds second parameter\n"
+ " /// @param a Documentation for the first parameter\n"
+ " /// @param not_existing Documentation for the second parameter\n"
+ " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n"
+ "}\n";
+
+ BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError);
+}
+
BOOST_AUTO_TEST_CASE(dev_mutiline_param_description)
{
char const* sourceCode = "contract test {\n"