mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8759 from ethereum/movePrintIndentedUp
Move helper up and avoid trailing spaces.
This commit is contained in:
commit
c7b4fa34bd
@ -19,6 +19,7 @@
|
|||||||
#include <test/TestCase.h>
|
#include <test/TestCase.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -60,6 +61,18 @@ void TestCase::expect(string::iterator& _it, string::iterator _end, string::valu
|
|||||||
++_it;
|
++_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestCase::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
||||||
|
{
|
||||||
|
stringstream output(_output);
|
||||||
|
string line;
|
||||||
|
while (getline(output, line))
|
||||||
|
if (line.empty())
|
||||||
|
// Avoid trailing spaces.
|
||||||
|
_stream << boost::trim_right_copy(_linePrefix) << endl;
|
||||||
|
else
|
||||||
|
_stream << _linePrefix << line << endl;
|
||||||
|
}
|
||||||
|
|
||||||
EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase(string const& _filename):
|
EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase(string const& _filename):
|
||||||
TestCase(_filename)
|
TestCase(_filename)
|
||||||
{
|
{
|
||||||
|
@ -93,6 +93,8 @@ protected:
|
|||||||
++_it;
|
++_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const;
|
||||||
|
|
||||||
TestCaseReader m_reader;
|
TestCaseReader m_reader;
|
||||||
bool m_shouldRun = true;
|
bool m_shouldRun = true;
|
||||||
};
|
};
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
#include <libsolutil/JSON.h>
|
#include <libsolutil/JSON.h>
|
||||||
#include <libsolutil/AnsiColorized.h>
|
#include <libsolutil/AnsiColorized.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -85,16 +83,3 @@ void ABIJsonTest::printUpdatedExpectations(ostream& _stream, string const& _line
|
|||||||
{
|
{
|
||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABIJsonTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
|
||||||
{
|
|
||||||
stringstream output(_output);
|
|
||||||
string line;
|
|
||||||
while (getline(output, line))
|
|
||||||
if (line.empty())
|
|
||||||
// Avoid trailing spaces.
|
|
||||||
_stream << boost::trim_right_copy(_linePrefix) << endl;
|
|
||||||
else
|
|
||||||
_stream << _linePrefix << line << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ public:
|
|||||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const;
|
|
||||||
|
|
||||||
std::string m_source;
|
std::string m_source;
|
||||||
std::string m_expectation;
|
std::string m_expectation;
|
||||||
std::string m_obtainedResult;
|
std::string m_obtainedResult;
|
||||||
|
@ -94,14 +94,6 @@ void EwasmTranslationTest::printUpdatedExpectations(ostream& _stream, string con
|
|||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EwasmTranslationTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
|
||||||
{
|
|
||||||
stringstream output(_output);
|
|
||||||
string line;
|
|
||||||
while (getline(output, line))
|
|
||||||
_stream << _linePrefix << line << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
||||||
{
|
{
|
||||||
AssemblyStack stack(
|
AssemblyStack stack(
|
||||||
|
@ -46,7 +46,6 @@ public:
|
|||||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const;
|
|
||||||
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
||||||
std::string interpret();
|
std::string interpret();
|
||||||
|
|
||||||
|
@ -82,14 +82,6 @@ void YulInterpreterTest::printUpdatedExpectations(ostream& _stream, string const
|
|||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YulInterpreterTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
|
||||||
{
|
|
||||||
stringstream output(_output);
|
|
||||||
string line;
|
|
||||||
while (getline(output, line))
|
|
||||||
_stream << _linePrefix << line << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
bool YulInterpreterTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
||||||
{
|
{
|
||||||
AssemblyStack stack(
|
AssemblyStack stack(
|
||||||
|
@ -51,7 +51,6 @@ public:
|
|||||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const;
|
|
||||||
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
||||||
std::string interpret();
|
std::string interpret();
|
||||||
|
|
||||||
|
@ -375,14 +375,6 @@ void YulOptimizerTest::printUpdatedExpectations(ostream& _stream, string const&
|
|||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YulOptimizerTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
|
||||||
{
|
|
||||||
stringstream output(_output);
|
|
||||||
string line;
|
|
||||||
while (getline(output, line))
|
|
||||||
_stream << _linePrefix << line << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
||||||
{
|
{
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
|
@ -60,7 +60,6 @@ public:
|
|||||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printIndented(std::ostream& _stream, std::string const& _output, std::string const& _linePrefix = "") const;
|
|
||||||
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted);
|
||||||
void disambiguate();
|
void disambiguate();
|
||||||
void updateContext();
|
void updateContext();
|
||||||
|
Loading…
Reference in New Issue
Block a user