mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
remove extra definition of printIndented
add CommonBaseTestCase class and inherit some of TestCase classes from it. Since that, remove print source extra definitions create the base defifnition for printUpdatedExpectations and remove extra definitions of the method make CommonBaseTestCase c-tor explicit include AnsiColorized.h and sort includes implement a common result checker move the common implementations into TastCase
This commit is contained in:
@@ -64,25 +64,6 @@ TestCase::TestResult ABIJsonTest::run(ostream& _stream, string const& _linePrefi
|
||||
m_obtainedResult += jsonPrettyPrint(compiler.contractABI(contractName)) + "\n";
|
||||
first = false;
|
||||
}
|
||||
if (m_expectation != m_obtainedResult)
|
||||
{
|
||||
string nextIndentLevel = _linePrefix + " ";
|
||||
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Expected result:" << endl;
|
||||
printIndented(_stream, m_expectation, nextIndentLevel);
|
||||
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) << _linePrefix << "Obtained result:" << endl;
|
||||
printIndented(_stream, m_obtainedResult, nextIndentLevel);
|
||||
return TestResult::Failure;
|
||||
}
|
||||
return TestResult::Success;
|
||||
}
|
||||
|
||||
|
||||
void ABIJsonTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const
|
||||
{
|
||||
printIndented(_stream, m_source, _linePrefix);
|
||||
}
|
||||
|
||||
void ABIJsonTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const
|
||||
{
|
||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||
return checkResult(_stream, _linePrefix, _formatted);
|
||||
}
|
||||
|
||||
@@ -36,14 +36,6 @@ public:
|
||||
ABIJsonTest(std::string const& _filename);
|
||||
|
||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||
|
||||
void printSource(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) const override;
|
||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||
|
||||
private:
|
||||
std::string m_source;
|
||||
std::string m_expectation;
|
||||
std::string m_obtainedResult;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||
private:
|
||||
std::vector<std::pair<std::string, std::string>> m_sources;
|
||||
std::string m_expectation;
|
||||
std::string m_expectationLegacy;
|
||||
std::string m_astFilename;
|
||||
std::string m_legacyAstFilename;
|
||||
|
||||
@@ -47,7 +47,6 @@ private:
|
||||
bool m_optimise = false;
|
||||
bool m_optimiseYul = false;
|
||||
size_t m_optimiseRuns = 200;
|
||||
std::string m_source;
|
||||
std::map<std::string, std::map<std::string, std::string>> m_expectations;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user