diff options
author | chriseth <chris@ethereum.org> | 2018-03-02 18:41:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 18:41:21 +0800 |
commit | 5982869e94965e48ec680fd32e6f80b8211fc34c (patch) | |
tree | 98c699a25c106ad7920571533459aa7b28d10363 /test | |
parent | f78d6a9a1ed623c4217762502532b3ceeef3cce8 (diff) | |
parent | 0f64648203b6b4631b42fcacf9eb71c3d94c921f (diff) | |
download | dexon-solidity-5982869e94965e48ec680fd32e6f80b8211fc34c.tar.gz dexon-solidity-5982869e94965e48ec680fd32e6f80b8211fc34c.tar.zst dexon-solidity-5982869e94965e48ec680fd32e6f80b8211fc34c.zip |
Merge pull request #3633 from ethereum/reserved-keywords-test
Parser: Add test case for reserved keywords.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 30 |
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"( |