From 3cd6ac418a8b7d9e4d97984166455b6bab7fe2b1 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Thu, 26 Oct 2017 14:13:33 -0300 Subject: [PATCH] Add missing name resolver tests --- .../SolidityNameAndTypeResolution.cpp | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index e5990e9b3..306242608 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"(