mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make formatting more consistent in natspec tests
This commit is contained in:
parent
6d05912d70
commit
be7c7dd4a9
@ -119,7 +119,8 @@ BOOST_AUTO_TEST_CASE(user_newline_break)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()":
|
||||
{
|
||||
"notice": "world"
|
||||
@ -147,8 +148,10 @@ BOOST_AUTO_TEST_CASE(user_multiline_empty_lines)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"f()": {
|
||||
"methods":
|
||||
{
|
||||
"f()":
|
||||
{
|
||||
"notice": "hello world"
|
||||
}
|
||||
}
|
||||
@ -188,7 +191,7 @@ BOOST_AUTO_TEST_CASE(dev_and_user_basic_test)
|
||||
|
||||
char const* devNatspec = R"R(
|
||||
{
|
||||
"methods" :
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
@ -199,7 +202,7 @@ BOOST_AUTO_TEST_CASE(dev_and_user_basic_test)
|
||||
|
||||
char const* userNatspec = R"R(
|
||||
{
|
||||
"methods" :
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
@ -307,16 +310,16 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
||||
|
||||
char const* devDoc = R"R(
|
||||
{
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"state" :
|
||||
"state":
|
||||
{
|
||||
"details" : "example of dev",
|
||||
"return" : "returns state",
|
||||
"returns" :
|
||||
"details": "example of dev",
|
||||
"return": "returns state",
|
||||
"returns":
|
||||
{
|
||||
"_0" : "returns state"
|
||||
"_0": "returns state"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,9 +329,9 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
||||
|
||||
char const* userDoc = R"R(
|
||||
{
|
||||
"methods" :
|
||||
"methods":
|
||||
{
|
||||
"state()" :
|
||||
"state()":
|
||||
{
|
||||
"notice": "example of notice"
|
||||
}
|
||||
@ -356,15 +359,15 @@ BOOST_AUTO_TEST_CASE(public_state_variable_struct)
|
||||
|
||||
char const* devDoc = R"R(
|
||||
{
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"coinStack" :
|
||||
"coinStack":
|
||||
{
|
||||
"returns" :
|
||||
"returns":
|
||||
{
|
||||
"observeGraphicURL" : "Front pic",
|
||||
"reverseGraphicURL" : "Back pic"
|
||||
"observeGraphicURL": "Front pic",
|
||||
"reverseGraphicURL": "Back pic"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -374,9 +377,9 @@ BOOST_AUTO_TEST_CASE(public_state_variable_struct)
|
||||
|
||||
char const* userDoc = R"R(
|
||||
{
|
||||
"methods" :
|
||||
"methods":
|
||||
{
|
||||
"coinStack(uint256)" :
|
||||
"coinStack(uint256)":
|
||||
{
|
||||
"notice": "Get the n-th coin I own"
|
||||
}
|
||||
@ -416,12 +419,12 @@ BOOST_AUTO_TEST_CASE(private_state_variable)
|
||||
|
||||
char const* devDoc = R"(
|
||||
{
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"state" :
|
||||
"state":
|
||||
{
|
||||
"details" : "example of dev"
|
||||
"details": "example of dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -644,8 +647,10 @@ BOOST_AUTO_TEST_CASE(dev_return_no_params)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"mul(uint256,uint256)": {
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"returns": { "d": "The result of the multiplication" }
|
||||
}
|
||||
}
|
||||
@ -879,7 +884,8 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
|
||||
char const* natspec = R"R({
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)": {
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"details": "Multiplies a number by 7 and adds second parameter",
|
||||
"params":
|
||||
{
|
||||
@ -1024,13 +1030,14 @@ BOOST_AUTO_TEST_CASE(natspec_notice_without_tag)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {
|
||||
"mul(uint256)" : {
|
||||
"notice" : "I do something awesome"
|
||||
}
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"notice": "I do something awesome"
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, true);
|
||||
}
|
||||
@ -1047,11 +1054,13 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {
|
||||
"mul(uint256)" : {
|
||||
"notice" : "I do something awesome which requires two lines to explain"
|
||||
}
|
||||
}
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"notice": "I do something awesome which requires two lines to explain"
|
||||
}
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
|
||||
@ -1067,7 +1076,7 @@ BOOST_AUTO_TEST_CASE(empty_comment)
|
||||
)";
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {}
|
||||
"methods": {}
|
||||
}
|
||||
)ABCDEF";
|
||||
|
||||
@ -1155,8 +1164,10 @@ BOOST_AUTO_TEST_CASE(user_constructor)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods": {
|
||||
"constructor" : {
|
||||
"methods":
|
||||
{
|
||||
"constructor":
|
||||
{
|
||||
"notice": "this is a really nice constructor"
|
||||
}
|
||||
}
|
||||
@ -1177,12 +1188,15 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"mul(uint256,uint256)" : {
|
||||
"notice" : "another multiplier"
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"notice": "another multiplier"
|
||||
},
|
||||
"constructor" : {
|
||||
"notice" : "this is a really nice constructor"
|
||||
"constructor":
|
||||
{
|
||||
"notice": "this is a really nice constructor"
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1201,11 +1215,14 @@ BOOST_AUTO_TEST_CASE(dev_constructor)
|
||||
)";
|
||||
|
||||
char const *natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"constructor" : {
|
||||
"params" : {
|
||||
"a" : "the parameter a is really nice and very useful",
|
||||
"second" : "the second parameter is not very useful, it just provides additional confusion"
|
||||
"methods":
|
||||
{
|
||||
"constructor":
|
||||
{
|
||||
"params":
|
||||
{
|
||||
"a": "the parameter a is really nice and very useful",
|
||||
"second": "the second parameter is not very useful, it just provides additional confusion"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1248,21 +1265,27 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
|
||||
)";
|
||||
|
||||
char const *natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"mul(uint256,uint256)" : {
|
||||
"details" : "Multiplies a number by 7 and adds second parameter",
|
||||
"params" : {
|
||||
"a" : "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
||||
"second" : "Documentation for the second parameter"
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"details": "Multiplies a number by 7 and adds second parameter",
|
||||
"params":
|
||||
{
|
||||
"a": "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
||||
"second": "Documentation for the second parameter"
|
||||
},
|
||||
"returns" : {
|
||||
"returns":
|
||||
{
|
||||
"d": "The result of the multiplication and cookies with nutella"
|
||||
}
|
||||
},
|
||||
"constructor" : {
|
||||
"params" : {
|
||||
"a" : "the parameter a is really nice and very useful",
|
||||
"second" : "the second parameter is not very useful, it just provides additional confusion"
|
||||
"constructor":
|
||||
{
|
||||
"params":
|
||||
{
|
||||
"a": "the parameter a is really nice and very useful",
|
||||
"second": "the second parameter is not very useful, it just provides additional confusion"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,7 +1335,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash3)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()": { "notice": "lorem ipsum" }
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1331,7 +1355,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash4)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()": { "notice": "lorem" }
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1360,12 +1385,12 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit_variable)
|
||||
})ABCDEF";
|
||||
|
||||
char const *natspec1 = R"ABCDEF({
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"x" :
|
||||
"x":
|
||||
{
|
||||
"details" : "test"
|
||||
"details": "test"
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1426,12 +1451,12 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_variable)
|
||||
})ABCDEF";
|
||||
|
||||
char const *natspec1 = R"ABCDEF({
|
||||
"methods" : {},
|
||||
"stateVariables" :
|
||||
"methods": {},
|
||||
"stateVariables":
|
||||
{
|
||||
"x" :
|
||||
"x":
|
||||
{
|
||||
"details" : "test"
|
||||
"details": "test"
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1487,7 +1512,7 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit)
|
||||
function transfer(address to, uint amount) virtual override external returns (bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contract Token is Middle {
|
||||
@ -1533,8 +1558,8 @@ BOOST_AUTO_TEST_CASE(user_default_inherit)
|
||||
contract Middle is ERC20 {
|
||||
function transfer(address to, uint amount) virtual override external returns (bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
contract Token is Middle {
|
||||
@ -2353,11 +2378,11 @@ BOOST_AUTO_TEST_CASE(error)
|
||||
char const* devdoc = R"X({
|
||||
"errors":{
|
||||
"E(uint256,uint256)": [{
|
||||
"details" : "an error.",
|
||||
"params" :
|
||||
"details": "an error.",
|
||||
"params":
|
||||
{
|
||||
"a" : "first parameter",
|
||||
"b" : "second parameter"
|
||||
"a": "first parameter",
|
||||
"b": "second parameter"
|
||||
}
|
||||
}]
|
||||
},
|
||||
@ -2369,7 +2394,7 @@ BOOST_AUTO_TEST_CASE(error)
|
||||
char const* userdoc = R"X({
|
||||
"errors":{
|
||||
"E(uint256,uint256)": [{
|
||||
"notice" : "Something failed."
|
||||
"notice": "Something failed."
|
||||
}]
|
||||
},
|
||||
"methods": {}
|
||||
@ -2404,22 +2429,23 @@ BOOST_AUTO_TEST_CASE(error_multiple)
|
||||
|
||||
char const* devdoc = R"X({
|
||||
"methods": {},
|
||||
"errors": {
|
||||
"errors":
|
||||
{
|
||||
"E(uint256,uint256)": [
|
||||
{
|
||||
"details" : "an error.",
|
||||
"params" :
|
||||
"details": "an error.",
|
||||
"params":
|
||||
{
|
||||
"x" : "first parameter",
|
||||
"y" : "second parameter"
|
||||
"x": "first parameter",
|
||||
"y": "second parameter"
|
||||
}
|
||||
},
|
||||
{
|
||||
"details" : "X an error.",
|
||||
"params" :
|
||||
"details": "X an error.",
|
||||
"params":
|
||||
{
|
||||
"a" : "X first parameter",
|
||||
"b" : "X second parameter"
|
||||
"a": "X first parameter",
|
||||
"b": "X second parameter"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -2431,8 +2457,8 @@ BOOST_AUTO_TEST_CASE(error_multiple)
|
||||
char const* userdoc = R"X({
|
||||
"errors":{
|
||||
"E(uint256,uint256)": [
|
||||
{ "notice" : "Something failed." },
|
||||
{ "notice" : "X Something failed." }
|
||||
{ "notice": "Something failed." },
|
||||
{ "notice": "X Something failed." }
|
||||
]
|
||||
},
|
||||
"methods": {}
|
||||
@ -2528,11 +2554,11 @@ BOOST_AUTO_TEST_CASE(dev_struct_getter_override)
|
||||
{
|
||||
"value()":
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -2580,11 +2606,11 @@ BOOST_AUTO_TEST_CASE(dev_struct_getter_override_different_return_parameter_names
|
||||
{
|
||||
"value()":
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
"returns":
|
||||
{
|
||||
"x": "a number",
|
||||
"y": "another number"
|
||||
}
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
|
Loading…
Reference in New Issue
Block a user