mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Call modifiers on constructor.
This commit is contained in:
parent
c657fe9611
commit
2b2da431bc
@ -1754,6 +1754,23 @@ BOOST_AUTO_TEST_CASE(function_modifier_calling_functions_in_creation_context)
|
||||
BOOST_CHECK(callContractFunction("getData()") == encodeArgs(0x4300));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_modifier_for_constructor)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract A {
|
||||
uint data;
|
||||
function A() mod1 { data |= 2; }
|
||||
modifier mod1 { data |= 1; _ }
|
||||
function getData() returns (uint r) { return data; }
|
||||
}
|
||||
contract C is A {
|
||||
modifier mod1 { data |= 4; _ }
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("getData()") == encodeArgs(4 | 2));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user