Merge pull request #6502 from ethereum/fix-ifn-loop

Fix infinite loop when encountering unexpected test specifications
This commit is contained in:
Mathias L. Baumann 2019-04-11 15:23:40 +02:00 committed by GitHub
commit 826f2d9084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -550,6 +550,11 @@ void TestFileParser::Scanner::scanNextToken()
token = selectToken(Token::Whitespace);
else if (isEndOfLine())
token = selectToken(Token::EOS);
else
throw Error(
Error::Type::ParserError,
"Unexpected character: '" + string{current()} + "'"
);
break;
}
}

View File

@ -775,6 +775,14 @@ BOOST_AUTO_TEST_CASE(call_arrow_missing)
BOOST_REQUIRE_THROW(parse(source), langutil::Error);
}
BOOST_AUTO_TEST_CASE(call_unexpected_character)
{
char const* source = R"(
// f() -> ??
)";
BOOST_REQUIRE_THROW(parse(source), langutil::Error);
}
BOOST_AUTO_TEST_SUITE_END()
}