Make formatting more consistent in natspec tests

This commit is contained in:
Marenz 2022-01-19 15:35:05 +01:00
parent 6d05912d70
commit be7c7dd4a9

View File

@ -119,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"
@ -147,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"
} }
} }
@ -644,8 +647,10 @@ BOOST_AUTO_TEST_CASE(dev_return_no_params)
char const* natspec = R"ABCDEF( char const* natspec = R"ABCDEF(
{ {
"methods": { "methods":
"mul(uint256,uint256)": { {
"mul(uint256,uint256)":
{
"returns": { "d": "The result of the multiplication" } "returns": { "d": "The result of the multiplication" }
} }
} }
@ -879,7 +884,8 @@ BOOST_AUTO_TEST_CASE(dev_multiline_return)
char const* natspec = R"R({ char const* natspec = R"R({
"methods": "methods":
{ {
"mul(uint256,uint256)": { "mul(uint256,uint256)":
{
"details": "Multiplies a number by 7 and adds second parameter", "details": "Multiplies a number by 7 and adds second parameter",
"params": "params":
{ {
@ -1024,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)" : { {
"mul(uint256)":
{
"notice": "I do something awesome" "notice": "I do something awesome"
} }
} }
} })ABCDEF";
)ABCDEF";
checkNatspec(sourceCode, "test", natspec, true); checkNatspec(sourceCode, "test", natspec, true);
} }
@ -1047,8 +1054,10 @@ BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
char const* natspec = R"ABCDEF( char const* natspec = R"ABCDEF(
{ {
"methods" : { "methods":
"mul(uint256)" : { {
"mul(uint256)":
{
"notice": "I do something awesome which requires two lines to explain" "notice": "I do something awesome which requires two lines to explain"
} }
} }
@ -1155,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"
} }
} }
@ -1177,11 +1188,14 @@ BOOST_AUTO_TEST_CASE(user_constructor_and_function)
)"; )";
char const* natspec = R"ABCDEF({ char const* natspec = R"ABCDEF({
"methods" : { "methods":
"mul(uint256,uint256)" : { {
"mul(uint256,uint256)":
{
"notice": "another multiplier" "notice": "another multiplier"
}, },
"constructor" : { "constructor":
{
"notice": "this is a really nice constructor" "notice": "this is a really nice constructor"
} }
} }
@ -1201,9 +1215,12 @@ BOOST_AUTO_TEST_CASE(dev_constructor)
)"; )";
char const *natspec = R"ABCDEF({ char const *natspec = R"ABCDEF({
"methods" : { "methods":
"constructor" : { {
"params" : { "constructor":
{
"params":
{
"a": "the parameter a is really nice and very useful", "a": "the parameter a is really nice and very useful",
"second": "the second parameter is not very useful, it just provides additional confusion" "second": "the second parameter is not very useful, it just provides additional confusion"
} }
@ -1248,19 +1265,25 @@ BOOST_AUTO_TEST_CASE(dev_constructor_and_function)
)"; )";
char const *natspec = R"ABCDEF({ char const *natspec = R"ABCDEF({
"methods" : { "methods":
"mul(uint256,uint256)" : { {
"mul(uint256,uint256)":
{
"details": "Multiplies a number by 7 and adds second parameter", "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", "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" "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" : { {
"params":
{
"a": "the parameter a is really nice and very useful", "a": "the parameter a is really nice and very useful",
"second": "the second parameter is not very useful, it just provides additional confusion" "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({ char const* natspec = R"ABCDEF({
"methods": { "methods":
{
"f()": { "notice": "lorem ipsum" } "f()": { "notice": "lorem ipsum" }
} }
})ABCDEF"; })ABCDEF";
@ -1331,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";
@ -2404,7 +2429,8 @@ 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.",