aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-27 22:53:46 +0800
committerGitHub <noreply@github.com>2017-10-27 22:53:46 +0800
commit1e085f85de1b3c389d3580db444cbe55cfaa754e (patch)
treef75ff578d2d25a1aea921e1bfe6c6e2f65971986
parent59d4dfbd9bf530db9260c7048423fe4c4b2870f5 (diff)
parent3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1 (diff)
downloaddexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar.gz
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar.bz2
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar.lz
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar.xz
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.tar.zst
dexon-solidity-1e085f85de1b3c389d3580db444cbe55cfaa754e.zip
Merge pull request #3133 from federicobond/add-missing-tests
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"(