mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'develop' into discovery
This commit is contained in:
commit
f3acbcce2f
@ -525,6 +525,49 @@ BOOST_AUTO_TEST_CASE(constructor_abi)
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(return_param_in_abi)
|
||||
{
|
||||
// bug #1801
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||
function test(ActionChoices param) {}
|
||||
function ret() returns(ActionChoices){
|
||||
ActionChoices action = ActionChoices.GoLeft;
|
||||
return action;
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
char const* interface = R"(
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"inputs" : [],
|
||||
"name" : "ret",
|
||||
"outputs" : [
|
||||
{
|
||||
"name" : "",
|
||||
"type" : "uint8"
|
||||
}
|
||||
],
|
||||
"type" : "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "param",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"type": "constructor"
|
||||
}
|
||||
]
|
||||
)";
|
||||
checkInterface(sourceCode, interface);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -508,6 +508,28 @@ BOOST_AUTO_TEST_CASE(function_external_types)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(enum_external_type)
|
||||
{
|
||||
// bug #1801
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
char const* text = R"(
|
||||
contract Test {
|
||||
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||
function boo(ActionChoices enumArg) external returns (uint ret) {
|
||||
ret = 5;
|
||||
}
|
||||
})";
|
||||
ETH_TEST_REQUIRE_NO_THROW(sourceUnit = parseTextAndResolveNames(text), "Parsing and name Resolving failed");
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->getNodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
{
|
||||
auto functions = contract->getDefinedFunctions();
|
||||
if (functions.empty())
|
||||
continue;
|
||||
BOOST_CHECK_EQUAL("boo(uint8)", functions[0]->externalSignature());
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_external_call_allowed_conversion)
|
||||
{
|
||||
char const* text = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user