From c965d6332c88e626249c7c3086b1f1c5df6129da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 21 Aug 2023 10:29:16 +0200 Subject: [PATCH] SyntaxTest: Allow derived test cases to filter out warnings and infos --- test/libsolidity/SyntaxTest.cpp | 11 ++++++++++- test/libsolidity/SyntaxTest.h | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index e0d7a17e9..ad53c2b26 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -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; diff --git a/test/libsolidity/SyntaxTest.h b/test/libsolidity/SyntaxTest.h index f9fd65319..a85e1f53f 100644 --- a/test/libsolidity/SyntaxTest.h +++ b/test/libsolidity/SyntaxTest.h @@ -41,7 +41,11 @@ public: { return std::make_unique(_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{}; }; }