mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Moves all interface function visibility related tests.
This commit is contained in:
parent
8fe1cfb12e
commit
601659c384
@ -6429,54 +6429,6 @@ BOOST_AUTO_TEST_CASE(interface_function_bodies)
|
||||
CHECK_ERROR(text, TypeError, "Functions in interfaces cannot have an implementation");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(interface_function_external)
|
||||
{
|
||||
char const* text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
interface I {
|
||||
function f() external;
|
||||
}
|
||||
)";
|
||||
CHECK_SUCCESS(text);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(interface_function_public)
|
||||
{
|
||||
char const* text = R"(
|
||||
interface I {
|
||||
function f() public;
|
||||
}
|
||||
)";
|
||||
CHECK_WARNING(text, "Functions in interfaces should be declared external.");
|
||||
text = R"(
|
||||
pragma experimental "v0.5.0";
|
||||
interface I {
|
||||
function f() public;
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Functions in interfaces must be declared external.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(interface_function_internal)
|
||||
{
|
||||
char const* text = R"(
|
||||
interface I {
|
||||
function f() internal;
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Functions in interfaces cannot be internal or private.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(interface_function_private)
|
||||
{
|
||||
char const* text = R"(
|
||||
interface I {
|
||||
function f() private;
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Functions in interfaces cannot be internal or private.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(interface_events)
|
||||
{
|
||||
char const* text = R"(
|
||||
|
@ -0,0 +1,5 @@
|
||||
pragma experimental "v0.5.0";
|
||||
interface I {
|
||||
function f() external;
|
||||
}
|
||||
// ----
|
@ -0,0 +1,5 @@
|
||||
interface I {
|
||||
function f() internal;
|
||||
}
|
||||
// ----
|
||||
// TypeError: Functions in interfaces cannot be internal or private.
|
@ -0,0 +1,5 @@
|
||||
interface I {
|
||||
function f() private;
|
||||
}
|
||||
// ----
|
||||
// TypeError: Functions in interfaces cannot be internal or private.
|
@ -0,0 +1,5 @@
|
||||
interface I {
|
||||
function f() public;
|
||||
}
|
||||
// ----
|
||||
// Warning: Functions in interfaces should be declared external.
|
@ -0,0 +1,6 @@
|
||||
pragma experimental "v0.5.0";
|
||||
interface I {
|
||||
function f() public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: Functions in interfaces must be declared external.
|
Loading…
Reference in New Issue
Block a user