Refactor ASTJSONTest to reduce redundancy

This commit is contained in:
Mathias Baumann
2020-08-27 15:56:41 +02:00
parent fdc4142b2c
commit c4962df262
3 changed files with 243 additions and 89 deletions
+23
View File
@@ -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;