aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-10-27 01:13:33 +0800
committerFederico Bond <federicobond@gmail.com>2017-10-27 01:13:33 +0800
commit3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1 (patch)
treebb6702e52679c3fbecc6823833aa73ae0210b693
parentcacc0e4b469e179b8e2ce73bf217b65ad720630c (diff)
downloaddexon-solidity-3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1.tar.gz
dexon-solidity-3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1.tar.zst
dexon-solidity-3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1.zip
Add missing name resolver tests
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index e5990e9b..30624260 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -4036,6 +4036,35 @@ BOOST_AUTO_TEST_CASE(varM_disqualified_as_keyword)
BOOST_CHECK(!success(text));
}
+BOOST_AUTO_TEST_CASE(modifier_is_not_a_valid_typename)
+{
+ char const* text = R"(
+ contract test {
+ modifier mod() { _; }
+
+ function f() public {
+ mod g;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Name has to refer to a struct, enum or contract.");
+}
+
+BOOST_AUTO_TEST_CASE(function_is_not_a_valid_typename)
+{
+ char const* text = R"(
+ contract test {
+ function foo() public {
+ }
+
+ function f() public {
+ foo g;
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Name has to refer to a struct, enum or contract.");
+}
+
BOOST_AUTO_TEST_CASE(long_uint_variable_fails)
{
char const* text = R"(