mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8800 from ethereum/natspec-bugfix
[BREAKING] NatSpec bugfix
This commit is contained in:
@@ -78,6 +78,81 @@ private:
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(SolidityNatspecJSON, DocumentationChecker)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(user_empty_natspec_test)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
///
|
||||
///
|
||||
function f() public {
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = R"(
|
||||
{
|
||||
"methods": {}
|
||||
}
|
||||
)";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(user_newline_break)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
///
|
||||
/// @notice hello
|
||||
|
||||
/// @notice world
|
||||
function f() public {
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"f()":
|
||||
{
|
||||
"notice": "world"
|
||||
}
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(user_multiline_empty_lines)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @notice hello world
|
||||
*/
|
||||
function f() public {
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* natspec = R"ABCDEF(
|
||||
{
|
||||
"methods": {
|
||||
"f()": {
|
||||
"notice": "hello world"
|
||||
}
|
||||
}
|
||||
}
|
||||
)ABCDEF";
|
||||
|
||||
checkNatspec(sourceCode, "test", natspec, true);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(user_basic_test)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
||||
@@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_comments_parsed)
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user");
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), " Send $(value / 1000) chocolates to the user");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiline_documentation_no_stars)
|
||||
@@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(multiline_documentation_whitespace_hell)
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Send $(value / 1000) chocolates to the user");
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), " Send $(value / 1000) chocolates to the user");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(comment_before_eos)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
///
|
||||
///
|
||||
function vote(uint id) public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user