Disable unimplemented library functions instead

This commit is contained in:
Alex Beregszaszi
2017-08-08 12:42:10 +01:00
parent 1ada48f61e
commit 8df89c5d5b
3 changed files with 19 additions and 34 deletions
@@ -6536,28 +6536,26 @@ BOOST_AUTO_TEST_CASE(constructor_without_implementation)
CHECK_ERROR(text, TypeError, "Constructor must be implemented if declared.");
}
BOOST_AUTO_TEST_CASE(calling_unimplemented_internal_functions)
{
char const* text = R"(
contract C {
function f() internal;
function g() { f(); }
}
)";
CHECK_SUCCESS_NO_WARNINGS(text);
}
BOOST_AUTO_TEST_CASE(calling_unimplemented_internal_library_functions)
BOOST_AUTO_TEST_CASE(library_function_without_implementation)
{
char const* text = R"(
library L {
function f() internal;
}
contract C {
function g() { L.f(); }
function f();
}
)";
CHECK_ERROR(text, TypeError, "Inlined library function is lacking implementation.");
CHECK_SUCCESS_NO_WARNINGS(text);
text = R"(
library L {
function f() internal;
}
)";
CHECK_ERROR(text, TypeError, "Internal library function must be implemented if declared.");
text = R"(
library L {
function f() private;
}
)";
CHECK_ERROR(text, TypeError, "Internal library function must be implemented if declared.");
}
BOOST_AUTO_TEST_SUITE_END()