aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-03-02 17:36:04 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-03-02 17:45:28 +0800
commit0f64648203b6b4631b42fcacf9eb71c3d94c921f (patch)
treeb9f9004544e8159a2ecb8124d94042d7a6da9146
parentc9840c98f45e6fa9258ec4624219622f5f71c75c (diff)
downloaddexon-solidity-0f64648203b6b4631b42fcacf9eb71c3d94c921f.tar.gz
dexon-solidity-0f64648203b6b4631b42fcacf9eb71c3d94c921f.tar.zst
dexon-solidity-0f64648203b6b4631b42fcacf9eb71c3d94c921f.zip
Parser: Add test case for reserved keywords.
-rw-r--r--test/libsolidity/SolidityParser.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index b7097d0f..f03b30e1 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -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"(