Tests for natspect parsing failure cases

This commit is contained in:
Lefteris Karapetsas 2017-01-27 12:13:14 +01:00
parent 0e021e76a5
commit f01c8c07e5
No known key found for this signature in database
GPG Key ID: AC4257C95510463E

View File

@ -635,6 +635,48 @@ BOOST_AUTO_TEST_CASE(dev_documenting_nonexistent_param)
expectNatspecError(sourceCode);
}
BOOST_AUTO_TEST_CASE(dev_documenting_no_paramname)
{
char const* sourceCode = R"(
contract test {
/// @dev Multiplies a number by 7 and adds second parameter
/// @param a Documentation for the first parameter
/// @param
function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }
}
)";
expectNatspecError(sourceCode);
}
BOOST_AUTO_TEST_CASE(dev_documenting_no_paramname_end)
{
char const* sourceCode = R"(
contract test {
/// @dev Multiplies a number by 7 and adds second parameter
/// @param a Documentation for the first parameter
/// @param se
function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }
}
)";
expectNatspecError(sourceCode);
}
BOOST_AUTO_TEST_CASE(dev_documenting_no_param_description)
{
char const* sourceCode = R"(
contract test {
/// @dev Multiplies a number by 7 and adds second parameter
/// @param a Documentation for the first parameter
/// @param second
function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }
}
)";
expectNatspecError(sourceCode);
}
BOOST_AUTO_TEST_SUITE_END()
}