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
|
||||
generatedDocumentation = m_compilerStack.natspecDev(_contractName);
|
||||
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["kind"] = Json::Value(_userDocumentation ? "user" : "dev");
|
||||
@ -118,7 +119,8 @@ BOOST_AUTO_TEST_CASE(user_newline_break)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()":
|
||||
{
|
||||
"notice": "world"
|
||||
@ -146,8 +148,10 @@ BOOST_AUTO_TEST_CASE(user_multiline_empty_lines)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"f()": {
|
||||
"methods":
|
||||
{
|
||||
"f()":
|
||||
{
|
||||
"notice": "hello world"
|
||||
}
|
||||
}
|
||||
@ -185,18 +189,27 @@ BOOST_AUTO_TEST_CASE(dev_and_user_basic_test)
|
||||
}
|
||||
)";
|
||||
|
||||
char const* devNatspec = "{"
|
||||
"\"methods\":{"
|
||||
" \"mul(uint256)\":{ \n"
|
||||
" \"details\": \"Multiplies a number by 7\"\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}}";
|
||||
char const* devNatspec = R"R(
|
||||
{
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"details": "Multiplies a number by 7"
|
||||
}
|
||||
}
|
||||
})R";
|
||||
|
||||
char const* userNatspec = "{"
|
||||
"\"methods\":{"
|
||||
" \"mul(uint256)\":{ \"notice\": \"Multiplies `a` by 7\"}"
|
||||
"}}";
|
||||
char const* userNatspec = R"R(
|
||||
{
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"notice": "Multiplies `a` by 7"
|
||||
}
|
||||
}
|
||||
})R";
|
||||
|
||||
checkNatspec(sourceCode, "test", devNatspec, false);
|
||||
checkNatspec(sourceCode, "test", userNatspec, true);
|
||||
@ -634,9 +647,11 @@ BOOST_AUTO_TEST_CASE(dev_return_no_params)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"mul(uint256,uint256)": {
|
||||
"returns": { "d": "The result of the multiplication"
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"returns": { "d": "The result of the multiplication" }
|
||||
}
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -866,19 +881,24 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = "{"
|
||||
"\"methods\":{"
|
||||
" \"mul(uint256,uint256)\":{ \n"
|
||||
" \"details\": \"Multiplies a number by 7 and adds second parameter\",\n"
|
||||
" \"params\": {\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"
|
||||
" },\n"
|
||||
" \"returns\": {\n"
|
||||
" \"d\": \"The result of the multiplication and cookies with nutella\",\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}}";
|
||||
char const* natspec = R"R({
|
||||
"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":
|
||||
{
|
||||
"d": "The result of the multiplication and cookies with nutella"
|
||||
}
|
||||
}
|
||||
}
|
||||
})R";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, false);
|
||||
}
|
||||
@ -901,19 +921,25 @@ BOOST_AUTO_TEST_CASE(dev_multiline_comment)
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = "{"
|
||||
"\"methods\":{"
|
||||
" \"mul(uint256,uint256)\":{ \n"
|
||||
" \"details\": \"Multiplies a number by 7 and adds second parameter\",\n"
|
||||
" \"params\": {\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"
|
||||
" },\n"
|
||||
" \"returns\": {\n"
|
||||
" \"d\": \"The result of the multiplication and cookies with nutella\",\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}}";
|
||||
char const* natspec = R"R(
|
||||
{
|
||||
"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":
|
||||
{
|
||||
"d": "The result of the multiplication and cookies with nutella"
|
||||
}
|
||||
}
|
||||
}
|
||||
})R";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, false);
|
||||
}
|
||||
@ -1004,13 +1030,14 @@ BOOST_AUTO_TEST_CASE(natspec_notice_without_tag)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {
|
||||
"mul(uint256)" : {
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"notice": "I do something awesome"
|
||||
}
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
})ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, true);
|
||||
}
|
||||
@ -1027,8 +1054,10 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods" : {
|
||||
"mul(uint256)" : {
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256)":
|
||||
{
|
||||
"notice": "I do something awesome which requires two lines to explain"
|
||||
}
|
||||
}
|
||||
@ -1135,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"
|
||||
}
|
||||
}
|
||||
@ -1157,11 +1188,14 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"mul(uint256,uint256)" : {
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"notice": "another multiplier"
|
||||
},
|
||||
"constructor" : {
|
||||
"constructor":
|
||||
{
|
||||
"notice": "this is a really nice constructor"
|
||||
}
|
||||
}
|
||||
@ -1181,9 +1215,12 @@ BOOST_AUTO_TEST_CASE(dev_constructor)
|
||||
)";
|
||||
|
||||
char const *natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"constructor" : {
|
||||
"params" : {
|
||||
"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"
|
||||
}
|
||||
@ -1228,19 +1265,25 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
|
||||
)";
|
||||
|
||||
char const *natspec = R"ABCDEF({
|
||||
"methods" : {
|
||||
"mul(uint256,uint256)" : {
|
||||
"methods":
|
||||
{
|
||||
"mul(uint256,uint256)":
|
||||
{
|
||||
"details": "Multiplies a number by 7 and adds second parameter",
|
||||
"params" : {
|
||||
"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" : {
|
||||
"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"
|
||||
}
|
||||
@ -1292,7 +1335,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash3)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()": { "notice": "lorem ipsum" }
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -1311,7 +1355,8 @@ BOOST_AUTO_TEST_CASE(slash3_slash4)
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF({
|
||||
"methods": {
|
||||
"methods":
|
||||
{
|
||||
"f()": { "notice": "lorem" }
|
||||
}
|
||||
})ABCDEF";
|
||||
@ -2295,7 +2340,7 @@ BOOST_AUTO_TEST_CASE(dev_return_name_no_description)
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"a": "a",
|
||||
"a": "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2308,7 +2353,7 @@ BOOST_AUTO_TEST_CASE(dev_return_name_no_description)
|
||||
{
|
||||
"returns":
|
||||
{
|
||||
"b": "a",
|
||||
"b": "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2384,7 +2429,8 @@ BOOST_AUTO_TEST_CASE(error_multiple)
|
||||
|
||||
char const* devdoc = R"X({
|
||||
"methods": {},
|
||||
"errors": {
|
||||
"errors":
|
||||
{
|
||||
"E(uint256,uint256)": [
|
||||
{
|
||||
"details": "an error.",
|
||||
@ -2465,7 +2511,8 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspecA = R"ABCDEF({
|
||||
char const* natspecA = R"ABCDEF(
|
||||
{
|
||||
"methods":
|
||||
{
|
||||
"g(uint256)":
|
||||
@ -2473,8 +2520,9 @@ BOOST_AUTO_TEST_CASE(custom_inheritance)
|
||||
"custom:since": "2014"
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
char const* natspecB = R"ABCDEF({
|
||||
})ABCDEF";
|
||||
char const* natspecB = R"ABCDEF(
|
||||
{
|
||||
"methods": {}
|
||||
})ABCDEF";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user