diff options
author | chriseth <c@ethdev.com> | 2015-03-31 01:38:20 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-31 01:38:20 +0800 |
commit | 8860f8d4c3590423f486559b11bf6c2db9bbab7a (patch) | |
tree | 6eb1bbbc12d2813f1e1de20267a9d938f8d9f027 | |
parent | ea98b3b07e30efdb8b146a1ad82006d2f1d949e2 (diff) | |
parent | 57432fe671110335b3779f4b03a76df133ee927d (diff) | |
download | dexon-solidity-8860f8d4c3590423f486559b11bf6c2db9bbab7a.tar.gz dexon-solidity-8860f8d4c3590423f486559b11bf6c2db9bbab7a.tar.zst dexon-solidity-8860f8d4c3590423f486559b11bf6c2db9bbab7a.zip |
Merge pull request #1464 from LefterisJP/natspec_nonexistant_param
Detect if non-existant parameter is documented with natspec
-rw-r--r-- | SolidityNatspecJSON.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp index edfe8986..aeaad196 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, "", false), DocstringParsingError); +} + BOOST_AUTO_TEST_CASE(dev_mutiline_param_description) { char const* sourceCode = "contract test {\n" @@ -487,17 +498,7 @@ BOOST_AUTO_TEST_CASE(dev_title_at_function_error) " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n" "}\n"; - char const* natspec = "{" - " \"author\": \"Lefteris\"," - " \"title\": \"Just a test contract\"," - " \"methods\":{" - " \"mul(uint256,uint256)\":{ \n" - " \"details\": \"Mul function\"\n" - " }\n" - " }\n" - "}"; - - BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError); + BOOST_CHECK_THROW(checkNatspec(sourceCode, "", false), DocstringParsingError); } BOOST_AUTO_TEST_CASE(natspec_notice_without_tag) |