mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make better use of virtual functions to customize CommonSyntaxTest in test cases based on it
This commit is contained in:
parent
511712570b
commit
aecb11eff4
@ -127,14 +127,11 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename): SyntaxTest(_filename, E
|
||||
m_modelCheckerSettings.bmcLoopIterations = std::optional<unsigned>{bmcLoopIterations};
|
||||
}
|
||||
|
||||
TestCase::TestResult SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
|
||||
void SMTCheckerTest::setupCompiler()
|
||||
{
|
||||
setupCompiler();
|
||||
compiler().setModelCheckerSettings(m_modelCheckerSettings);
|
||||
parseAndAnalyze();
|
||||
filterObtainedErrors();
|
||||
SyntaxTest::setupCompiler();
|
||||
|
||||
return conclude(_stream, _linePrefix, _formatted);
|
||||
compiler().setModelCheckerSettings(m_modelCheckerSettings);
|
||||
}
|
||||
|
||||
void SMTCheckerTest::filterObtainedErrors()
|
||||
|
@ -38,8 +38,7 @@ public:
|
||||
}
|
||||
SMTCheckerTest(std::string const& _filename);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
|
||||
|
||||
void setupCompiler() override;
|
||||
void filterObtainedErrors() override;
|
||||
|
||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||
|
@ -43,15 +43,6 @@ SyntaxTest::SyntaxTest(string const& _filename, langutil::EVMVersion _evmVersion
|
||||
m_parserErrorRecovery = _parserErrorRecovery;
|
||||
}
|
||||
|
||||
TestCase::TestResult SyntaxTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
|
||||
{
|
||||
setupCompiler();
|
||||
parseAndAnalyze();
|
||||
filterObtainedErrors();
|
||||
|
||||
return conclude(_stream, _linePrefix, _formatted);
|
||||
}
|
||||
|
||||
string SyntaxTest::addPreamble(string const& _sourceCode)
|
||||
{
|
||||
// Silence compiler version warning
|
||||
@ -83,6 +74,8 @@ void SyntaxTest::setupCompiler()
|
||||
|
||||
void SyntaxTest::parseAndAnalyze()
|
||||
{
|
||||
setupCompiler();
|
||||
|
||||
if (compiler().parse() && compiler().analyze())
|
||||
try
|
||||
{
|
||||
@ -112,6 +105,8 @@ void SyntaxTest::parseAndAnalyze()
|
||||
-1
|
||||
});
|
||||
}
|
||||
|
||||
filterObtainedErrors();
|
||||
}
|
||||
|
||||
void SyntaxTest::filterObtainedErrors()
|
||||
|
@ -47,13 +47,11 @@ public:
|
||||
}
|
||||
SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion, bool _parserErrorRecovery = false);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool _formatted = false) override;
|
||||
|
||||
protected:
|
||||
/// Returns @param _sourceCode prefixed with the version pragma and the SPDX license identifier.
|
||||
static std::string addPreamble(std::string const& _sourceCode);
|
||||
|
||||
void setupCompiler();
|
||||
virtual void setupCompiler();
|
||||
void parseAndAnalyze() override;
|
||||
virtual void filterObtainedErrors();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user