mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refactor ASTJSONTest to reduce redundancy
This commit is contained in:
@@ -26,9 +26,15 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace solidity::frontend
|
||||
{
|
||||
class CompilerStack;
|
||||
}
|
||||
|
||||
namespace solidity::frontend::test
|
||||
{
|
||||
|
||||
|
||||
class ASTJSONTest: public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -41,6 +47,23 @@ public:
|
||||
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:
|
||||
bool runTest(
|
||||
std::string& _expectation,
|
||||
std::string& _result,
|
||||
std::map<std::string, unsigned> const& _sourceIndicies,
|
||||
CompilerStack& _compiler,
|
||||
bool _legacy,
|
||||
std::string const& _variation,
|
||||
std::ostream& _stream,
|
||||
std::string const& _linePrefix = "",
|
||||
bool const _formatted = false
|
||||
);
|
||||
void updateExpectation(
|
||||
std::string const& _filename,
|
||||
std::string const& _expectation,
|
||||
std::string const& _variation
|
||||
) const;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> m_sources;
|
||||
std::string m_expectationLegacy;
|
||||
std::string m_astFilename;
|
||||
|
||||
Reference in New Issue
Block a user