Complete error coverage of ParserBase

This commit is contained in:
a3d4
2020-09-28 01:56:25 +02:00
parent b34465c5ef
commit 9721bda36e
6 changed files with 60 additions and 37 deletions
-36
View File
@@ -599,42 +599,6 @@ BOOST_AUTO_TEST_CASE(complex_import)
BOOST_CHECK(successParse(text));
}
BOOST_AUTO_TEST_CASE(recursion_depth1)
{
string text("contract C { bytes");
for (size_t i = 0; i < 30000; i++)
text += "[";
CHECK_PARSE_ERROR(text.c_str(), "Maximum recursion depth reached during parsing");
}
BOOST_AUTO_TEST_CASE(recursion_depth2)
{
string text("contract C { function f() {");
for (size_t i = 0; i < 30000; i++)
text += "{";
CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing");
}
BOOST_AUTO_TEST_CASE(recursion_depth3)
{
string text("contract C { function f() { uint x = f(");
for (size_t i = 0; i < 30000; i++)
text += "(";
CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing");
}
BOOST_AUTO_TEST_CASE(recursion_depth4)
{
string text("contract C { function f() { uint a;");
for (size_t i = 0; i < 30000; i++)
text += "(";
text += "a";
for (size_t i = 0; i < 30000; i++)
text += "++)";
text += "}}";
CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing");
}
BOOST_AUTO_TEST_CASE(inline_asm_end_location)
{
auto sourceCode = std::string(R"(