mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add unamed return param test and check size in conditional
This commit is contained in:
parent
b3ae601e88
commit
18fe693fdd
@ -119,7 +119,7 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef)
|
||||
{
|
||||
string paramName = returnParams.at(n)->name();
|
||||
|
||||
if (!paramName.empty())
|
||||
if (!paramName.empty() && returnParams.size() != 1)
|
||||
{
|
||||
ret[paramName] = Json::Value(i->second.content);
|
||||
n++;
|
||||
|
@ -415,6 +415,37 @@ BOOST_AUTO_TEST_CASE(dev_return_desc_after_nl)
|
||||
checkNatspec(sourceCode, "test", natspec, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dev_return_desc_multiple_unamed)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
/// @dev Multiplies a number by 7 and adds second parameter
|
||||
/// @param a Documentation for the first parameter starts here.
|
||||
/// Since it's a really complicated parameter we need 2 lines
|
||||
/// @param second Documentation for the second parameter
|
||||
/// @return The result of the multiplication
|
||||
/// @return And cookies with nutella
|
||||
function mul(uint a, uint second) public returns (uint, uint) {
|
||||
uint mul = a * 7;
|
||||
return (mul, second);
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = "{"
|
||||
"\"methods\":{"
|
||||
" \"mul(uint256,uint256)\":{ \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 multiplicationAnd cookies with nutella\"\n"
|
||||
" }\n"
|
||||
"}}";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dev_return_desc_multiple)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user