mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12552 from ethereum/missing-bracket
Add missing bracket in test
This commit is contained in:
commit
c3c5937bd7
@ -56,7 +56,8 @@ public:
|
|||||||
else
|
else
|
||||||
generatedDocumentation = m_compilerStack.natspecDev(_contractName);
|
generatedDocumentation = m_compilerStack.natspecDev(_contractName);
|
||||||
Json::Value expectedDocumentation;
|
Json::Value expectedDocumentation;
|
||||||
util::jsonParseStrict(_expectedDocumentationString, expectedDocumentation);
|
std::string parseError;
|
||||||
|
BOOST_REQUIRE_MESSAGE(util::jsonParseStrict(_expectedDocumentationString, expectedDocumentation, &parseError), parseError);
|
||||||
|
|
||||||
expectedDocumentation["version"] = Json::Value(Natspec::c_natspecVersion);
|
expectedDocumentation["version"] = Json::Value(Natspec::c_natspecVersion);
|
||||||
expectedDocumentation["kind"] = Json::Value(_userDocumentation ? "user" : "dev");
|
expectedDocumentation["kind"] = Json::Value(_userDocumentation ? "user" : "dev");
|
||||||
@ -118,7 +119,8 @@ BOOST_AUTO_TEST_CASE(user_newline_break)
|
|||||||
|
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods": {
|
"methods":
|
||||||
|
{
|
||||||
"f()":
|
"f()":
|
||||||
{
|
{
|
||||||
"notice": "world"
|
"notice": "world"
|
||||||
@ -146,8 +148,10 @@ BOOST_AUTO_TEST_CASE(user_multiline_empty_lines)
|
|||||||
|
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods": {
|
"methods":
|
||||||
"f()": {
|
{
|
||||||
|
"f()":
|
||||||
|
{
|
||||||
"notice": "hello world"
|
"notice": "hello world"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,18 +189,27 @@ BOOST_AUTO_TEST_CASE(dev_and_user_basic_test)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
char const* devNatspec = "{"
|
char const* devNatspec = R"R(
|
||||||
"\"methods\":{"
|
{
|
||||||
" \"mul(uint256)\":{ \n"
|
"methods":
|
||||||
" \"details\": \"Multiplies a number by 7\"\n"
|
{
|
||||||
" }\n"
|
"mul(uint256)":
|
||||||
" }\n"
|
{
|
||||||
"}}";
|
"details": "Multiplies a number by 7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})R";
|
||||||
|
|
||||||
char const* userNatspec = "{"
|
char const* userNatspec = R"R(
|
||||||
"\"methods\":{"
|
{
|
||||||
" \"mul(uint256)\":{ \"notice\": \"Multiplies `a` by 7\"}"
|
"methods":
|
||||||
"}}";
|
{
|
||||||
|
"mul(uint256)":
|
||||||
|
{
|
||||||
|
"notice": "Multiplies `a` by 7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})R";
|
||||||
|
|
||||||
checkNatspec(sourceCode, "test", devNatspec, false);
|
checkNatspec(sourceCode, "test", devNatspec, false);
|
||||||
checkNatspec(sourceCode, "test", userNatspec, true);
|
checkNatspec(sourceCode, "test", userNatspec, true);
|
||||||
@ -297,16 +310,16 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
|||||||
|
|
||||||
char const* devDoc = R"R(
|
char const* devDoc = R"R(
|
||||||
{
|
{
|
||||||
"methods" : {},
|
"methods": {},
|
||||||
"stateVariables" :
|
"stateVariables":
|
||||||
{
|
{
|
||||||
"state" :
|
"state":
|
||||||
{
|
{
|
||||||
"details" : "example of dev",
|
"details": "example of dev",
|
||||||
"return" : "returns state",
|
"return": "returns state",
|
||||||
"returns" :
|
"returns":
|
||||||
{
|
{
|
||||||
"_0" : "returns state"
|
"_0": "returns state"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,9 +329,9 @@ BOOST_AUTO_TEST_CASE(public_state_variable)
|
|||||||
|
|
||||||
char const* userDoc = R"R(
|
char const* userDoc = R"R(
|
||||||
{
|
{
|
||||||
"methods" :
|
"methods":
|
||||||
{
|
{
|
||||||
"state()" :
|
"state()":
|
||||||
{
|
{
|
||||||
"notice": "example of notice"
|
"notice": "example of notice"
|
||||||
}
|
}
|
||||||
@ -346,15 +359,15 @@ BOOST_AUTO_TEST_CASE(public_state_variable_struct)
|
|||||||
|
|
||||||
char const* devDoc = R"R(
|
char const* devDoc = R"R(
|
||||||
{
|
{
|
||||||
"methods" : {},
|
"methods": {},
|
||||||
"stateVariables" :
|
"stateVariables":
|
||||||
{
|
{
|
||||||
"coinStack" :
|
"coinStack":
|
||||||
{
|
{
|
||||||
"returns" :
|
"returns":
|
||||||
{
|
{
|
||||||
"observeGraphicURL" : "Front pic",
|
"observeGraphicURL": "Front pic",
|
||||||
"reverseGraphicURL" : "Back pic"
|
"reverseGraphicURL": "Back pic"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,9 +377,9 @@ BOOST_AUTO_TEST_CASE(public_state_variable_struct)
|
|||||||
|
|
||||||
char const* userDoc = R"R(
|
char const* userDoc = R"R(
|
||||||
{
|
{
|
||||||
"methods" :
|
"methods":
|
||||||
{
|
{
|
||||||
"coinStack(uint256)" :
|
"coinStack(uint256)":
|
||||||
{
|
{
|
||||||
"notice": "Get the n-th coin I own"
|
"notice": "Get the n-th coin I own"
|
||||||
}
|
}
|
||||||
@ -406,12 +419,12 @@ BOOST_AUTO_TEST_CASE(private_state_variable)
|
|||||||
|
|
||||||
char const* devDoc = R"(
|
char const* devDoc = R"(
|
||||||
{
|
{
|
||||||
"methods" : {},
|
"methods": {},
|
||||||
"stateVariables" :
|
"stateVariables":
|
||||||
{
|
{
|
||||||
"state" :
|
"state":
|
||||||
{
|
{
|
||||||
"details" : "example of dev"
|
"details": "example of dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -634,9 +647,11 @@ BOOST_AUTO_TEST_CASE(dev_return_no_params)
|
|||||||
|
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods": {
|
"methods":
|
||||||
"mul(uint256,uint256)": {
|
{
|
||||||
"returns": { "d": "The result of the multiplication"
|
"mul(uint256,uint256)":
|
||||||
|
{
|
||||||
|
"returns": { "d": "The result of the multiplication" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -866,19 +881,24 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = "{"
|
char const* natspec = R"R({
|
||||||
"\"methods\":{"
|
"methods":
|
||||||
" \"mul(uint256,uint256)\":{ \n"
|
{
|
||||||
" \"details\": \"Multiplies a number by 7 and adds second parameter\",\n"
|
"mul(uint256,uint256)":
|
||||||
" \"params\": {\n"
|
{
|
||||||
" \"a\": \"Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines\",\n"
|
"details": "Multiplies a number by 7 and adds second parameter",
|
||||||
" \"second\": \"Documentation for the second parameter\"\n"
|
"params":
|
||||||
" },\n"
|
{
|
||||||
" \"returns\": {\n"
|
"a": "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
||||||
" \"d\": \"The result of the multiplication and cookies with nutella\",\n"
|
"second": "Documentation for the second parameter"
|
||||||
" }\n"
|
},
|
||||||
" }\n"
|
"returns":
|
||||||
"}}";
|
{
|
||||||
|
"d": "The result of the multiplication and cookies with nutella"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})R";
|
||||||
|
|
||||||
checkNatspec(sourceCode, "test", natspec, false);
|
checkNatspec(sourceCode, "test", natspec, false);
|
||||||
}
|
}
|
||||||
@ -901,19 +921,25 @@ BOOST_AUTO_TEST_CASE(dev_multiline_comment)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = "{"
|
char const* natspec = R"R(
|
||||||
"\"methods\":{"
|
{
|
||||||
" \"mul(uint256,uint256)\":{ \n"
|
"methods":
|
||||||
" \"details\": \"Multiplies a number by 7 and adds second parameter\",\n"
|
{
|
||||||
" \"params\": {\n"
|
"mul(uint256,uint256)":
|
||||||
" \"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"
|
"details": "Multiplies a number by 7 and adds second parameter",
|
||||||
" },\n"
|
"params":
|
||||||
" \"returns\": {\n"
|
{
|
||||||
" \"d\": \"The result of the multiplication and cookies with nutella\",\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"
|
},
|
||||||
"}}";
|
"returns":
|
||||||
|
{
|
||||||
|
"d": "The result of the multiplication and cookies with nutella"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})R";
|
||||||
|
|
||||||
checkNatspec(sourceCode, "test", natspec, false);
|
checkNatspec(sourceCode, "test", natspec, false);
|
||||||
}
|
}
|
||||||
@ -1004,13 +1030,14 @@ BOOST_AUTO_TEST_CASE(natspec_notice_without_tag)
|
|||||||
|
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods" : {
|
"methods":
|
||||||
"mul(uint256)" : {
|
{
|
||||||
"notice" : "I do something awesome"
|
"mul(uint256)":
|
||||||
|
{
|
||||||
|
"notice": "I do something awesome"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})ABCDEF";
|
||||||
)ABCDEF";
|
|
||||||
|
|
||||||
checkNatspec(sourceCode, "test", natspec, true);
|
checkNatspec(sourceCode, "test", natspec, true);
|
||||||
}
|
}
|
||||||
@ -1027,9 +1054,11 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
|
|||||||
|
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods" : {
|
"methods":
|
||||||
"mul(uint256)" : {
|
{
|
||||||
"notice" : "I do something awesome which requires two lines to explain"
|
"mul(uint256)":
|
||||||
|
{
|
||||||
|
"notice": "I do something awesome which requires two lines to explain"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,7 +1076,7 @@ BOOST_AUTO_TEST_CASE(empty_comment)
|
|||||||
)";
|
)";
|
||||||
char const* natspec = R"ABCDEF(
|
char const* natspec = R"ABCDEF(
|
||||||
{
|
{
|
||||||
"methods" : {}
|
"methods": {}
|
||||||
}
|
}
|
||||||
)ABCDEF";
|
)ABCDEF";
|
||||||
|
|
||||||
@ -1135,8 +1164,10 @@ BOOST_AUTO_TEST_CASE(user_constructor)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = R"ABCDEF({
|
char const* natspec = R"ABCDEF({
|
||||||
"methods": {
|
"methods":
|
||||||
"constructor" : {
|
{
|
||||||
|
"constructor":
|
||||||
|
{
|
||||||
"notice": "this is a really nice constructor"
|
"notice": "this is a really nice constructor"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1157,12 +1188,15 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = R"ABCDEF({
|
char const* natspec = R"ABCDEF({
|
||||||
"methods" : {
|
"methods":
|
||||||
"mul(uint256,uint256)" : {
|
{
|
||||||
"notice" : "another multiplier"
|
"mul(uint256,uint256)":
|
||||||
|
{
|
||||||
|
"notice": "another multiplier"
|
||||||
},
|
},
|
||||||
"constructor" : {
|
"constructor":
|
||||||
"notice" : "this is a really nice constructor"
|
{
|
||||||
|
"notice": "this is a really nice constructor"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -1181,11 +1215,14 @@ BOOST_AUTO_TEST_CASE(dev_constructor)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const *natspec = R"ABCDEF({
|
char const *natspec = R"ABCDEF({
|
||||||
"methods" : {
|
"methods":
|
||||||
"constructor" : {
|
{
|
||||||
"params" : {
|
"constructor":
|
||||||
"a" : "the parameter a is really nice and very useful",
|
{
|
||||||
"second" : "the second parameter is not very useful, it just provides additional confusion"
|
"params":
|
||||||
|
{
|
||||||
|
"a": "the parameter a is really nice and very useful",
|
||||||
|
"second": "the second parameter is not very useful, it just provides additional confusion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,21 +1265,27 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const *natspec = R"ABCDEF({
|
char const *natspec = R"ABCDEF({
|
||||||
"methods" : {
|
"methods":
|
||||||
"mul(uint256,uint256)" : {
|
{
|
||||||
"details" : "Multiplies a number by 7 and adds second parameter",
|
"mul(uint256,uint256)":
|
||||||
"params" : {
|
{
|
||||||
"a" : "Documentation for the first parameter starts here. Since it's a really complicated parameter we need 2 lines",
|
"details": "Multiplies a number by 7 and adds second parameter",
|
||||||
"second" : "Documentation for the 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"
|
"d": "The result of the multiplication and cookies with nutella"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"constructor" : {
|
"constructor":
|
||||||
"params" : {
|
{
|
||||||
"a" : "the parameter a is really nice and very useful",
|
"params":
|
||||||
"second" : "the second parameter is not very useful, it just provides additional confusion"
|
{
|
||||||
|
"a": "the parameter a is really nice and very useful",
|
||||||
|
"second": "the second parameter is not very useful, it just provides additional confusion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1292,7 +1335,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash3)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = R"ABCDEF({
|
char const* natspec = R"ABCDEF({
|
||||||
"methods": {
|
"methods":
|
||||||
|
{
|
||||||
"f()": { "notice": "lorem ipsum" }
|
"f()": { "notice": "lorem ipsum" }
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -1311,7 +1355,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash4)
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspec = R"ABCDEF({
|
char const* natspec = R"ABCDEF({
|
||||||
"methods": {
|
"methods":
|
||||||
|
{
|
||||||
"f()": { "notice": "lorem" }
|
"f()": { "notice": "lorem" }
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -1340,12 +1385,12 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit_variable)
|
|||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
|
|
||||||
char const *natspec1 = R"ABCDEF({
|
char const *natspec1 = R"ABCDEF({
|
||||||
"methods" : {},
|
"methods": {},
|
||||||
"stateVariables" :
|
"stateVariables":
|
||||||
{
|
{
|
||||||
"x" :
|
"x":
|
||||||
{
|
{
|
||||||
"details" : "test"
|
"details": "test"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -1406,12 +1451,12 @@ BOOST_AUTO_TEST_CASE(dev_explicit_inherit_variable)
|
|||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
|
|
||||||
char const *natspec1 = R"ABCDEF({
|
char const *natspec1 = R"ABCDEF({
|
||||||
"methods" : {},
|
"methods": {},
|
||||||
"stateVariables" :
|
"stateVariables":
|
||||||
{
|
{
|
||||||
"x" :
|
"x":
|
||||||
{
|
{
|
||||||
"details" : "test"
|
"details": "test"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
@ -2295,7 +2340,7 @@ BOOST_AUTO_TEST_CASE(dev_return_name_no_description)
|
|||||||
{
|
{
|
||||||
"returns":
|
"returns":
|
||||||
{
|
{
|
||||||
"a": "a",
|
"a": "a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2308,7 +2353,7 @@ BOOST_AUTO_TEST_CASE(dev_return_name_no_description)
|
|||||||
{
|
{
|
||||||
"returns":
|
"returns":
|
||||||
{
|
{
|
||||||
"b": "a",
|
"b": "a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2333,11 +2378,11 @@ BOOST_AUTO_TEST_CASE(error)
|
|||||||
char const* devdoc = R"X({
|
char const* devdoc = R"X({
|
||||||
"errors":{
|
"errors":{
|
||||||
"E(uint256,uint256)": [{
|
"E(uint256,uint256)": [{
|
||||||
"details" : "an error.",
|
"details": "an error.",
|
||||||
"params" :
|
"params":
|
||||||
{
|
{
|
||||||
"a" : "first parameter",
|
"a": "first parameter",
|
||||||
"b" : "second parameter"
|
"b": "second parameter"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
@ -2349,7 +2394,7 @@ BOOST_AUTO_TEST_CASE(error)
|
|||||||
char const* userdoc = R"X({
|
char const* userdoc = R"X({
|
||||||
"errors":{
|
"errors":{
|
||||||
"E(uint256,uint256)": [{
|
"E(uint256,uint256)": [{
|
||||||
"notice" : "Something failed."
|
"notice": "Something failed."
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"methods": {}
|
"methods": {}
|
||||||
@ -2384,22 +2429,23 @@ BOOST_AUTO_TEST_CASE(error_multiple)
|
|||||||
|
|
||||||
char const* devdoc = R"X({
|
char const* devdoc = R"X({
|
||||||
"methods": {},
|
"methods": {},
|
||||||
"errors": {
|
"errors":
|
||||||
|
{
|
||||||
"E(uint256,uint256)": [
|
"E(uint256,uint256)": [
|
||||||
{
|
{
|
||||||
"details" : "an error.",
|
"details": "an error.",
|
||||||
"params" :
|
"params":
|
||||||
{
|
{
|
||||||
"x" : "first parameter",
|
"x": "first parameter",
|
||||||
"y" : "second parameter"
|
"y": "second parameter"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"details" : "X an error.",
|
"details": "X an error.",
|
||||||
"params" :
|
"params":
|
||||||
{
|
{
|
||||||
"a" : "X first parameter",
|
"a": "X first parameter",
|
||||||
"b" : "X second parameter"
|
"b": "X second parameter"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -2411,8 +2457,8 @@ BOOST_AUTO_TEST_CASE(error_multiple)
|
|||||||
char const* userdoc = R"X({
|
char const* userdoc = R"X({
|
||||||
"errors":{
|
"errors":{
|
||||||
"E(uint256,uint256)": [
|
"E(uint256,uint256)": [
|
||||||
{ "notice" : "Something failed." },
|
{ "notice": "Something failed." },
|
||||||
{ "notice" : "X Something failed." }
|
{ "notice": "X Something failed." }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"methods": {}
|
"methods": {}
|
||||||
@ -2465,7 +2511,8 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
char const* natspecA = R"ABCDEF({
|
char const* natspecA = R"ABCDEF(
|
||||||
|
{
|
||||||
"methods":
|
"methods":
|
||||||
{
|
{
|
||||||
"g(uint256)":
|
"g(uint256)":
|
||||||
@ -2473,8 +2520,9 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
|||||||
"custom:since": "2014"
|
"custom:since": "2014"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)ABCDEF";
|
})ABCDEF";
|
||||||
char const* natspecB = R"ABCDEF({
|
char const* natspecB = R"ABCDEF(
|
||||||
|
{
|
||||||
"methods": {}
|
"methods": {}
|
||||||
})ABCDEF";
|
})ABCDEF";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user