SyntaxTest: Allow derived test cases to filter out warnings and infos

This commit is contained in:
Kamil Śliwak 2023-08-21 10:29:16 +02:00
parent 73b9077ab0
commit c965d6332c
2 changed files with 16 additions and 2 deletions

View File

@ -38,7 +38,13 @@ using namespace solidity::frontend::test;
using namespace boost::unit_test;
namespace fs = boost::filesystem;
SyntaxTest::SyntaxTest(string const& _filename, langutil::EVMVersion _evmVersion): CommonSyntaxTest(_filename, _evmVersion)
SyntaxTest::SyntaxTest(
string const& _filename,
langutil::EVMVersion _evmVersion,
Error::Severity _minSeverity
):
CommonSyntaxTest(_filename, _evmVersion),
m_minSeverity(_minSeverity)
{
m_optimiseYul = m_reader.boolSetting("optimize-yul", true);
}
@ -98,6 +104,9 @@ void SyntaxTest::filterObtainedErrors()
{
for (auto const& currentError: filteredErrors())
{
if (currentError->severity() < m_minSeverity)
continue;
int locationStart = -1;
int locationEnd = -1;
string sourceName;

View File

@ -41,7 +41,11 @@ public:
{
return std::make_unique<SyntaxTest>(_config.filename, _config.evmVersion);
}
SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion);
SyntaxTest(
std::string const& _filename,
langutil::EVMVersion _evmVersion,
langutil::Error::Severity _minSeverity = langutil::Error::Severity::Info
);
protected:
virtual void setupCompiler();
@ -49,6 +53,7 @@ protected:
virtual void filterObtainedErrors();
bool m_optimiseYul{};
langutil::Error::Severity m_minSeverity{};
};
}