mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop
This commit is contained in:
commit
fd773be884
@ -1610,6 +1610,28 @@ BOOST_AUTO_TEST_CASE(function_usage_in_constructor_arguments)
|
|||||||
BOOST_CHECK(callContractFunction("getA()") == encodeArgs(2));
|
BOOST_CHECK(callContractFunction("getA()") == encodeArgs(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(virtual_function_usage_in_constructor_arguments)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract BaseBase {
|
||||||
|
uint m_a;
|
||||||
|
function BaseBase(uint a) {
|
||||||
|
m_a = a;
|
||||||
|
}
|
||||||
|
function overridden() returns (uint r) { return 1; }
|
||||||
|
function g() returns (uint r) { return overridden(); }
|
||||||
|
}
|
||||||
|
contract Base is BaseBase(BaseBase.g()) {
|
||||||
|
}
|
||||||
|
contract Derived is Base() {
|
||||||
|
function getA() returns (uint r) { return m_a; }
|
||||||
|
function overridden() returns (uint r) { return 2; }
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode, 0, "Derived");
|
||||||
|
BOOST_CHECK(callContractFunction("getA()") == encodeArgs(2));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(constructor_argument_overriding)
|
BOOST_AUTO_TEST_CASE(constructor_argument_overriding)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
|
@ -506,17 +506,35 @@ BOOST_AUTO_TEST_CASE(dev_title_at_function_error)
|
|||||||
BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError);
|
BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for bug where having no tags in docstring would cause infinite loop
|
BOOST_AUTO_TEST_CASE(natspec_notice_without_tag)
|
||||||
BOOST_AUTO_TEST_CASE(natspec_no_tags)
|
|
||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
" /// I do something awesome\n"
|
" /// I do something awesome\n"
|
||||||
" function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n"
|
" function mul(uint a) returns(uint d) { return a * 7; }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
char const* natspec = "{\"methods\": {}}";
|
char const* natspec = "{"
|
||||||
|
"\"methods\":{"
|
||||||
|
" \"mul(uint256)\":{ \"notice\": \"I do something awesome\"}"
|
||||||
|
"}}";
|
||||||
|
|
||||||
checkNatspec(sourceCode, natspec, false);
|
checkNatspec(sourceCode, natspec, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
|
||||||
|
{
|
||||||
|
char const* sourceCode = "contract test {\n"
|
||||||
|
" /// I do something awesome\n"
|
||||||
|
" /// which requires two lines to explain\n"
|
||||||
|
" function mul(uint a) returns(uint d) { return a * 7; }\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
char const* natspec = "{"
|
||||||
|
"\"methods\":{"
|
||||||
|
" \"mul(uint256)\":{ \"notice\": \"I do something awesome which requires two lines to explain\"}"
|
||||||
|
"}}";
|
||||||
|
|
||||||
|
checkNatspec(sourceCode, natspec, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user