mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix: Allow multiple @return tags on public state variables
This commit is contained in:
@@ -328,6 +328,73 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
||||
checkNatspec(sourceCode, "test", userDoc, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(public_state_variable_struct)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Bank {
|
||||
struct Coin {
|
||||
string observeGraphicURL;
|
||||
string reverseGraphicURL;
|
||||
}
|
||||
|
||||
/// @notice Get the n-th coin I own
|
||||
/// @return observeGraphicURL Front pic
|
||||
/// @return reverseGraphicURL Back pic
|
||||
Coin[] public coinStack;
|
||||
}
|
||||
)";
|
||||
|
||||
char const* devDoc = R"R(
|
||||
{
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
{
|
||||
"coinStack" :
|
||||
{
|
||||
"returns" :
|
||||
{
|
||||
"observeGraphicURL" : "Front pic",
|
||||
"reverseGraphicURL" : "Back pic"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)R";
|
||||
checkNatspec(sourceCode, "Bank", devDoc, false);
|
||||
|
||||
char const* userDoc = R"R(
|
||||
{
|
||||
"methods" :
|
||||
{
|
||||
"coinStack(uint256)" :
|
||||
{
|
||||
"notice": "Get the n-th coin I own"
|
||||
}
|
||||
}
|
||||
}
|
||||
)R";
|
||||
checkNatspec(sourceCode, "Bank", userDoc, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(public_state_variable_struct_repeated)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Bank {
|
||||
struct Coin {
|
||||
string obverseGraphicURL;
|
||||
string reverseGraphicURL;
|
||||
}
|
||||
|
||||
/// @notice Get the n-th coin I own
|
||||
/// @return obverseGraphicURL Front pic
|
||||
/// @return obverseGraphicURL Front pic
|
||||
Coin[] public coinStack;
|
||||
}
|
||||
)";
|
||||
|
||||
expectNatspecError(sourceCode);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(private_state_variable)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract test {
|
||||
uint public state;
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 5256: (18-137): Documentation tag "@return" is only allowed once on state-variables.
|
||||
// DocstringParsingError 2604: (18-137): Documentation tag "@return returns something" exceeds the number of return parameters.
|
||||
|
||||
Reference in New Issue
Block a user