mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Parsing of not fully implemented functions
- Adding the possibility of omitting a function body by simply ending a function definition with a semicolon - Such a function is marked as not fully implemented and any contract that contains such a function is considered a not fully implemented contract
This commit is contained in:
parent
0934d0e943
commit
fc0b32f683
@ -346,6 +346,21 @@ BOOST_AUTO_TEST_CASE(comparison_bitop_precedence)
|
||||
ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_no_implementation)
|
||||
{
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
char const* text = "contract test {\n"
|
||||
" function functionName(bytes32 input) returns (bytes32 out);\n"
|
||||
"}\n";
|
||||
ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed");
|
||||
ContractDefinition* contract;
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
|
||||
contract = dynamic_cast<ContractDefinition*>(node.get());
|
||||
BOOST_CHECK(contract);
|
||||
BOOST_CHECK(!contract->isFullyImplemented());
|
||||
BOOST_CHECK(!contract->getDefinedFunctions()[0]->isFullyImplemented());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_canonical_signature)
|
||||
{
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
|
@ -108,6 +108,14 @@ BOOST_AUTO_TEST_CASE(single_function_param)
|
||||
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_no_body)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" function functionName(bytes32 input) returns (bytes32 out);\n"
|
||||
"}\n";
|
||||
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(missing_parameter_name_in_named_args)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
|
Loading…
Reference in New Issue
Block a user