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:
@@ -1,7 +0,0 @@
|
||||
contract C {
|
||||
///
|
||||
///
|
||||
function vote(uint id) public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -1,11 +0,0 @@
|
||||
contract C {
|
||||
/// @title example of title
|
||||
/// @author example of author
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
enum Color {
|
||||
Red,
|
||||
Green
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -1,5 +0,0 @@
|
||||
abstract contract C {
|
||||
/// @return value The value returned by this function.
|
||||
function vote() public virtual returns (uint value);
|
||||
}
|
||||
// ----
|
||||
@@ -1,12 +0,0 @@
|
||||
contract C {
|
||||
/**
|
||||
* @dev a function
|
||||
* @param _from 5 from address
|
||||
* @param _5to : to address
|
||||
* @param value: token transfer amount
|
||||
* @param value? token transfer amount
|
||||
*/
|
||||
function f(address _from, address _5to, uint256 value) internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -1,6 +0,0 @@
|
||||
contract C {
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
uint private state;
|
||||
}
|
||||
// ----
|
||||
@@ -1,6 +0,0 @@
|
||||
contract C {
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
uint public state;
|
||||
}
|
||||
// ----
|
||||
@@ -1,12 +0,0 @@
|
||||
contract C {
|
||||
/// @title example of title
|
||||
/// @author example of author
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
struct Example {
|
||||
string text;
|
||||
bool valid;
|
||||
uint256 value;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -1,13 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure returns (uint) {
|
||||
/// @title example of title
|
||||
/// @author example of author
|
||||
/// @notice example of notice
|
||||
/// @dev example of dev
|
||||
/// @param example of param
|
||||
/// @return example of return
|
||||
uint state = 42;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -1,6 +0,0 @@
|
||||
contract C {
|
||||
/// @author author
|
||||
function iHaveAuthor() public pure {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (17-35): Documentation tag @author not valid for functions.
|
||||
@@ -1,8 +0,0 @@
|
||||
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.
|
||||
@@ -1,6 +0,0 @@
|
||||
contract C {
|
||||
/// @param id
|
||||
function vote(uint id) public {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 9942: (17-30): No description given for param id
|
||||
@@ -1,6 +0,0 @@
|
||||
abstract contract C {
|
||||
/// @param
|
||||
function vote(uint id) public {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 3335: (26-36): No param name given
|
||||
@@ -1,10 +0,0 @@
|
||||
contract C {
|
||||
///@return
|
||||
modifier m22 virtual { _; }
|
||||
}
|
||||
|
||||
contract D is C {
|
||||
modifier m22 override { _; }
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (14-24): Documentation tag @return not valid for modifiers.
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
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.
|
||||
@@ -1,7 +0,0 @@
|
||||
contract C {
|
||||
/// @inheritdoc X
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 9397: (17-34): Documentation tag @inheritdoc references inexistent contract "X".
|
||||
@@ -1,10 +0,0 @@
|
||||
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.
|
||||
@@ -1,11 +0,0 @@
|
||||
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.
|
||||
@@ -1,19 +0,0 @@
|
||||
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.
|
||||
@@ -1,9 +0,0 @@
|
||||
contract B {}
|
||||
|
||||
contract C {
|
||||
/// @inheritdoc B
|
||||
/// @inheritdoc B
|
||||
function f() internal {}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 5142: (32-71): Documentation tag @inheritdoc can only be given once.
|
||||
@@ -1,8 +0,0 @@
|
||||
contract C {
|
||||
struct S { uint a; }
|
||||
/// @inheritdoc S
|
||||
function f() internal {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 1430: (42-59): Documentation tag @inheritdoc reference "S" is not a contract.
|
||||
@@ -1,7 +0,0 @@
|
||||
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
@@ -1,6 +0,0 @@
|
||||
contract test {
|
||||
/// @return returns something
|
||||
uint private state;
|
||||
}
|
||||
// ----
|
||||
// DocstringParsingError 6546: (18-47): Documentation tag @return not valid for non-public state variables.
|
||||
@@ -1,11 +0,0 @@
|
||||
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.
|
||||
@@ -1,11 +0,0 @@
|
||||
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.
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
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.
|
||||
@@ -1,8 +0,0 @@
|
||||
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.
|
||||
@@ -1,17 +0,0 @@
|
||||
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.
|
||||
@@ -1,19 +0,0 @@
|
||||
/// @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.
|
||||
@@ -1,14 +0,0 @@
|
||||
interface IThing {
|
||||
/// @return x a number
|
||||
/// @return y another number
|
||||
function value() external view returns (uint128 x, uint128 y);
|
||||
}
|
||||
|
||||
contract Thing is IThing {
|
||||
struct Value {
|
||||
uint128 x;
|
||||
uint128 y;
|
||||
}
|
||||
|
||||
Value public override value;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
interface IThing {
|
||||
/// @param v value to search for
|
||||
/// @return x a number
|
||||
/// @return y another number
|
||||
function value(uint256 v) external view returns (uint128 x, uint128 y);
|
||||
}
|
||||
|
||||
contract Thing is IThing {
|
||||
struct Value {
|
||||
uint128 x;
|
||||
uint128 y;
|
||||
}
|
||||
|
||||
mapping(uint256=>Value) public override value;
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user