test: disallow more than one errors in name and type tests

This commit is contained in:
Yoichi Hirai 2016-11-21 15:26:05 +01:00
parent 34327c5d8a
commit 01215694f6
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -62,7 +62,11 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false,
SyntaxChecker syntaxChecker(errors);
if (!syntaxChecker.checkSyntax(*sourceUnit))
{
if (errors.size() > 1)
BOOST_FAIL("Multiple errors found after checking syntax.");
return make_pair(sourceUnit, errors.at(0));
}
std::shared_ptr<GlobalContext> globalContext = make_shared<GlobalContext>();
NameAndTypeResolver resolver(globalContext->declarations(), errors);
@ -89,8 +93,12 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false,
TypeChecker typeChecker(errors);
bool success = typeChecker.checkTypeRequirements(*contract);
BOOST_CHECK(success || !errors.empty());
if (errors.size() > 1)
BOOST_FAIL("Multiple errors found after checking type requirements");
}
if (errors.size() > 1)
BOOST_FAIL("Multiple errors found");
for (auto const& currentError: errors)
{
if (