mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use AnalysisFramework's error formatting and filtering features in more test cases
This commit is contained in:
parent
e42242cd6f
commit
6d8b1374c5
@ -70,7 +70,7 @@ AnalysisFramework::parseAnalyseAndReturnError(
|
|||||||
|
|
||||||
ErrorList errors = filteredErrors(_reportWarnings);
|
ErrorList errors = filteredErrors(_reportWarnings);
|
||||||
if (errors.size() > 1 && !_allowMultipleErrors)
|
if (errors.size() > 1 && !_allowMultipleErrors)
|
||||||
BOOST_FAIL("Multiple errors found: " + formatErrors(compiler().errors()));
|
BOOST_FAIL("Multiple errors found: " + formatErrors(errors));
|
||||||
|
|
||||||
return make_pair(&compiler().ast(""), std::move(errors));
|
return make_pair(&compiler().ast(""), std::move(errors));
|
||||||
}
|
}
|
||||||
|
@ -118,8 +118,7 @@ TestCase::TestResult GasTest::run(ostream& _stream, string const& _linePrefix, b
|
|||||||
|
|
||||||
if (!compiler().parseAndAnalyze() || !compiler().compile())
|
if (!compiler().parseAndAnalyze() || !compiler().compile())
|
||||||
{
|
{
|
||||||
SourceReferenceFormatter{_stream, compiler(), _formatted, false}
|
_stream << formatErrors(filteredErrors(), _formatted);
|
||||||
.printErrorInformation(compiler().errors());
|
|
||||||
return TestResult::FatalError;
|
return TestResult::FatalError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,10 @@ TestCase::TestResult MemoryGuardTest::run(ostream& _stream, string const& _lineP
|
|||||||
compiler().setViaIR(true);
|
compiler().setViaIR(true);
|
||||||
compiler().setOptimiserSettings(OptimiserSettings::none());
|
compiler().setOptimiserSettings(OptimiserSettings::none());
|
||||||
if (!compiler().compile())
|
if (!compiler().compile())
|
||||||
|
{
|
||||||
|
_stream << formatErrors(filteredErrors(), _formatted);
|
||||||
return TestResult::FatalError;
|
return TestResult::FatalError;
|
||||||
|
}
|
||||||
|
|
||||||
m_obtainedResult.clear();
|
m_obtainedResult.clear();
|
||||||
for (string contractName: compiler().contractNames())
|
for (string contractName: compiler().contractNames())
|
||||||
|
@ -42,7 +42,10 @@ BOOST_AUTO_TEST_CASE(does_not_include_creation_time_only_internal_functions)
|
|||||||
)";
|
)";
|
||||||
compiler().setOptimiserSettings(solidity::test::CommonOptions::get().optimize);
|
compiler().setOptimiserSettings(solidity::test::CommonOptions::get().optimize);
|
||||||
BOOST_REQUIRE(success(sourceCode));
|
BOOST_REQUIRE(success(sourceCode));
|
||||||
BOOST_REQUIRE_MESSAGE(compiler().compile(), "Compiling contract failed");
|
BOOST_REQUIRE_MESSAGE(
|
||||||
|
compiler().compile(),
|
||||||
|
"Contract compilation failed:\n" + formatErrors(filteredErrors(), true /* _colored */)
|
||||||
|
);
|
||||||
bytes const& creationBytecode = solidity::test::bytecodeSansMetadata(compiler().object("C").bytecode);
|
bytes const& creationBytecode = solidity::test::bytecodeSansMetadata(compiler().object("C").bytecode);
|
||||||
bytes const& runtimeBytecode = solidity::test::bytecodeSansMetadata(compiler().runtimeObject("C").bytecode);
|
bytes const& runtimeBytecode = solidity::test::bytecodeSansMetadata(compiler().runtimeObject("C").bytecode);
|
||||||
BOOST_CHECK(creationBytecode.size() >= 90);
|
BOOST_CHECK(creationBytecode.size() >= 90);
|
||||||
|
Loading…
Reference in New Issue
Block a user