Browse Source

add two parsing test cases related to overloaded functions

cl-refactor
Lu Guanqun 10 years ago
parent
commit
2a48091ff2
  1. 25
      test/SolidityParser.cpp

25
test/SolidityParser.cpp

@ -126,6 +126,31 @@ BOOST_AUTO_TEST_CASE(missing_argument_in_named_args)
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)
{
ASTPointer<ContractDefinition> contract;

Loading…
Cancel
Save