mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move Natspec syntax tests to natspecJSON
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
/// @author author
|
||||
function iHaveAuthor() public pure {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (17-35): Documentation tag @author not valid for functions.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
/// @title title
|
||||
/// @author author
|
||||
uint private state;
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (17-56): Documentation tag @author not valid for non-public state variables.
|
||||
// DocstringParsingError 6546: (17-56): Documentation tag @title not valid for non-public state variables.
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
/// @param id
|
||||
function vote(uint id) public {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 9942: (17-30): No description given for param id
|
||||
@@ -0,0 +1,6 @@
|
||||
abstract contract C {
|
||||
/// @param
|
||||
function vote(uint id) public {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 3335: (26-36): No param name given
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
///@return
|
||||
modifier m22 virtual { _; }
|
||||
}
|
||||
|
||||
contract D is C {
|
||||
modifier m22 override { _; }
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (14-24): Documentation tag @return not valid for modifiers.
|
||||
@@ -0,0 +1,12 @@
|
||||
contract A {
|
||||
/// @return a
|
||||
function g(int x) public virtual { return 2; }
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
function g(int x) public pure override returns (int b) { return 2; }
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 2604: (14-27): Documentation tag "@return a" exceeds the number of return parameters.
|
||||
// TypeError 4822: (98-166): Overriding function return types differ.
|
||||
// TypeError 8863: (64-72): Different number of arguments in return statement than in returns declaration.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
/// @inheritdoc X
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 9397: (17-34): Documentation tag @inheritdoc references inexistent contract "X".
|
||||
@@ -0,0 +1,10 @@
|
||||
contract D {
|
||||
}
|
||||
|
||||
contract C is D {
|
||||
/// @inheritdoc D
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 4682: (38-55): Documentation tag @inheritdoc references contract "D", but the contract does not contain a function that is overridden by this function.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract D {
|
||||
struct S { uint a; }
|
||||
}
|
||||
|
||||
contract C is D {
|
||||
/// @inheritdoc D.S
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 1430: (63-82): Documentation tag @inheritdoc reference "D.S" is not a contract.
|
||||
@@ -0,0 +1,19 @@
|
||||
contract C {
|
||||
/// @inheritdoc
|
||||
function f() internal {
|
||||
}
|
||||
/// @inheritdoc .
|
||||
function f() internal {
|
||||
}
|
||||
/// @inheritdoc C..f
|
||||
function f() internal {
|
||||
}
|
||||
/// @inheritdoc C.
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 1933: (17-32): Expected contract name following documentation tag @inheritdoc.
|
||||
// DocstringParsingError 5967: (71-88): Documentation tag @inheritdoc reference "." is malformed.
|
||||
// DocstringParsingError 5967: (127-147): Documentation tag @inheritdoc reference "C..f" is malformed.
|
||||
// DocstringParsingError 5967: (186-204): Documentation tag @inheritdoc reference "C." is malformed.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract B {}
|
||||
|
||||
contract C {
|
||||
/// @inheritdoc B
|
||||
/// @inheritdoc B
|
||||
function f() internal {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 5142: (32-71): Documentation tag @inheritdoc can only be given once.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
struct S { uint a; }
|
||||
/// @inheritdoc S
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 1430: (42-59): Documentation tag @inheritdoc reference "S" is not a contract.
|
||||
@@ -0,0 +1,7 @@
|
||||
abstract contract C {
|
||||
/// @param id Some identifier
|
||||
/// @return No value returned
|
||||
function vote(uint id) public virtual returns (uint value);
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 5856: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract test {
|
||||
/// @return returns something
|
||||
uint private state;
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (18-47): Documentation tag @return not valid for non-public state variables.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
/**
|
||||
* @param 5value a value parameter
|
||||
* @param _ a value parameter
|
||||
*/
|
||||
function f(uint256 _5value, uint256 _value, uint256 value) internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 3881: (17-101): Documented parameter "" not found in the parameter list of the function.
|
||||
// DocstringParsingError 3881: (17-101): Documented parameter "_" not found in the parameter list of the function.
|
||||
@@ -0,0 +1,11 @@
|
||||
abstract contract C {
|
||||
/// @param id Some identifier
|
||||
/// @return No value returned
|
||||
function vote(uint id) public virtual returns (uint value);
|
||||
|
||||
/// @return No value returned
|
||||
function unvote(uint id) public virtual returns (uint value);
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 5856: (26-89): Documentation tag "@return No value returned" does not contain the name of its return parameter.
|
||||
// DocstringParsingError 5856: (159-188): Documentation tag "@return No value returned" does not contain the name of its return parameter.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract test {
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
/// @return returns something
|
||||
/// @return returns something
|
||||
uint public state;
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 2604: (18-137): Documentation tag "@return returns something" exceeds the number of return parameters.
|
||||
@@ -0,0 +1,8 @@
|
||||
abstract contract C {
|
||||
/// @param id Some identifier
|
||||
/// @return value Some value
|
||||
/// @return value2 Some value 2
|
||||
function vote(uint id) public virtual returns (uint value);
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 2604: (26-121): Documentation tag "@return value2 Some value 2" exceeds the number of return parameters.
|
||||
@@ -0,0 +1,17 @@
|
||||
contract ERC20 {
|
||||
/// @notice This event is emitted when a transfer occurs.
|
||||
/// @param from The source account.
|
||||
/// @param to The destination account.
|
||||
/// @param amount The amount.
|
||||
/// @dev A test case!
|
||||
event Transfer(address indexed from, address indexed to, uint amount);
|
||||
}
|
||||
|
||||
contract A is ERC20 {
|
||||
/// @inheritdoc ERC20
|
||||
event Transfer();
|
||||
}
|
||||
|
||||
|
||||
// ----
|
||||
// DocstringParsingError 6546: (305-326): Documentation tag @inheritdoc not valid for events.
|
||||
@@ -0,0 +1,19 @@
|
||||
/// @a&b test
|
||||
contract C {
|
||||
/// @custom:x^y test2
|
||||
function f() public pure {}
|
||||
/// @custom:
|
||||
function g() public pure {}
|
||||
/// @custom:abcDEF
|
||||
function h() public pure {}
|
||||
/// @custom:abc-def
|
||||
function i() public pure {}
|
||||
/// @custom
|
||||
function j() public pure {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (0-14): Documentation tag @a&b not valid for contracts.
|
||||
// DocstringParsingError 2968: (28-49): Invalid character in custom tag @custom:x^y. Only lowercase letters and "-" are permitted.
|
||||
// DocstringParsingError 6564: (80-92): Custom documentation tag must contain a chosen name, i.e. @custom:mytag.
|
||||
// DocstringParsingError 2968: (123-141): Invalid character in custom tag @custom:abcDEF. Only lowercase letters and "-" are permitted.
|
||||
// DocstringParsingError 6564: (222-233): Custom documentation tag must contain a chosen name, i.e. @custom:mytag.
|
||||
Reference in New Issue
Block a user