Merge pull request #3633 from ethereum/reserved-keywords-test

Parser: Add test case for reserved keywords.
This commit is contained in:
chriseth 2018-03-02 11:41:21 +01:00 committed by GitHub
commit 5982869e94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1164,6 +1164,36 @@ BOOST_AUTO_TEST_CASE(constant_is_keyword)
CHECK_PARSE_ERROR(text, "Expected identifier");
}
BOOST_AUTO_TEST_CASE(keyword_is_reserved)
{
auto keywords = {
"abstract",
"after",
"case",
"catch",
"default",
"final",
"in",
"inline",
"let",
"match",
"null",
"of",
"relocatable",
"static",
"switch",
"try",
"type",
"typeof"
};
for (const auto& keyword: keywords)
{
auto text = std::string("contract ") + keyword + " {}";
CHECK_PARSE_ERROR(text.c_str(), "Expected identifier");
}
}
BOOST_AUTO_TEST_CASE(var_array)
{
char const* text = R"(