aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-07-18 12:10:57 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-12 05:45:25 +0800
commitf0dc5720551a12febbe1a61461218de24e18e07a (patch)
treedf9aa8ebfeb387e29191dba15f0fdfd8d1db0a0f
parentff5bb54e3c19bedfadd06dd60f032fd7cdc55389 (diff)
downloaddexon-solidity-f0dc5720551a12febbe1a61461218de24e18e07a.tar.gz
dexon-solidity-f0dc5720551a12febbe1a61461218de24e18e07a.tar.zst
dexon-solidity-f0dc5720551a12febbe1a61461218de24e18e07a.zip
Improve and add missing tests
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index f7648bd7..49a23e13 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -924,16 +924,25 @@ BOOST_AUTO_TEST_CASE(illegal_override_visibility)
contract B { function f() internal {} }
contract C is B { function f() public {} }
)";
- CHECK_ERROR(text, TypeError, "Override changes extended function signature.");
+ CHECK_ERROR(text, TypeError, "Overriding function visibility differs");
}
-BOOST_AUTO_TEST_CASE(illegal_override_constness)
+BOOST_AUTO_TEST_CASE(illegal_override_remove_constness)
{
char const* text = R"(
contract B { function f() constant {} }
contract C is B { function f() {} }
)";
- CHECK_ERROR(text, TypeError, "Override changes extended function signature.");
+ CHECK_ERROR(text, TypeError, "Overriding function should be declared constant.");
+}
+
+BOOST_AUTO_TEST_CASE(illegal_override_add_constness)
+{
+ char const* text = R"(
+ contract B { function f() {} }
+ contract C is B { function f() constant {} }
+ )";
+ CHECK_ERROR(text, TypeError, "Overriding function should not be declared constant.");
}
BOOST_AUTO_TEST_CASE(complex_inheritance)
@@ -2491,7 +2500,7 @@ BOOST_AUTO_TEST_CASE(override_changes_return_types)
function f(uint a) returns (uint8) { }
}
)";
- CHECK_ERROR(sourceCode, TypeError, "Override changes extended function signature.");
+ CHECK_ERROR(sourceCode, TypeError, "Overriding function return types differ");
}
BOOST_AUTO_TEST_CASE(multiple_constructors)
@@ -4732,7 +4741,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_payable)
contract B { function f() payable {} }
contract C is B { function f() {} }
)";
- CHECK_ERROR(text, TypeError, "Override changes extended function signature.");
+ CHECK_ERROR(text, TypeError, "Overriding function should be declared payable.");
}
BOOST_AUTO_TEST_CASE(illegal_override_payable_nonpayable)
@@ -4741,7 +4750,7 @@ BOOST_AUTO_TEST_CASE(illegal_override_payable_nonpayable)
contract B { function f() {} }
contract C is B { function f() payable {} }
)";
- CHECK_ERROR(text, TypeError, "Override changes extended function signature.");
+ CHECK_ERROR(text, TypeError, "Overriding function should not be declared payable.");
}
BOOST_AUTO_TEST_CASE(function_variable_mixin)