mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
add two parsing test cases related to overloaded functions
This commit is contained in:
parent
52e9a85d62
commit
a1eed07432
@ -126,6 +126,31 @@ BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
|
|||||||
BOOST_CHECK_THROW(parseText(text), ParserError);
|
BOOST_CHECK_THROW(parseText(text), ParserError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(two_exact_functions)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
function fun(uint a) returns(uint r) { return a; }
|
||||||
|
function fun(uint a) returns(uint r) { return a; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
// with support of overloaded functions, during parsing,
|
||||||
|
// we can't determine whether they match exactly, however
|
||||||
|
// it will throw DeclarationError in following stage.
|
||||||
|
BOOST_CHECK_NO_THROW(parseText(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(overloaded_functions)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract test {
|
||||||
|
function fun(uint a) returns(uint r) { return a; }
|
||||||
|
function fun(uint a, uint b) returns(uint r) { return a + b; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_NO_THROW(parseText(text));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
|
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
|
||||||
{
|
{
|
||||||
ASTPointer<ContractDefinition> contract;
|
ASTPointer<ContractDefinition> contract;
|
||||||
|
Loading…
Reference in New Issue
Block a user