mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Put stripPreReleaseWarning() next to withPreamble()
This commit is contained in:
parent
ec92685bcb
commit
2baf9d4d82
@ -18,6 +18,8 @@
|
||||
|
||||
#include <test/libsolidity/util/Common.h>
|
||||
|
||||
#include <regex>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity;
|
||||
using namespace solidity::frontend;
|
||||
@ -49,3 +51,17 @@ StringMap test::withPreamble(StringMap _sources, bool _addAbicoderV1Pragma)
|
||||
|
||||
return _sources;
|
||||
}
|
||||
|
||||
string test::stripPreReleaseWarning(string const& _stderrContent)
|
||||
{
|
||||
static regex const preReleaseWarningRegex{
|
||||
R"(Warning( \(3805\))?: This is a pre-release compiler version, please do not use it in production\.\n)"
|
||||
R"((\n)?)"
|
||||
};
|
||||
static regex const noOutputRegex{
|
||||
R"(Compiler run successful, no output requested\.\n)"
|
||||
};
|
||||
|
||||
string output = regex_replace(_stderrContent, preReleaseWarningRegex, "");
|
||||
return regex_replace(std::move(output), noOutputRegex, "");
|
||||
}
|
||||
|
@ -32,4 +32,6 @@ std::string withPreamble(std::string const& _sourceCode, bool _addAbicoderV1Prag
|
||||
/// @returns a copy of @p _sources with preamble prepended to all sources.
|
||||
StringMap withPreamble(StringMap _sources, bool _addAbicoderV1Pragma = false);
|
||||
|
||||
std::string stripPreReleaseWarning(std::string const& _stderrContent);
|
||||
|
||||
} // namespace solidity::frontend::test
|
||||
|
@ -17,6 +17,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
#include <test/solc/Common.h>
|
||||
#include <test/libsolidity/util/Common.h>
|
||||
|
||||
#include <solc/CommandLineInterface.h>
|
||||
|
||||
@ -79,17 +80,3 @@ test::OptionsReaderAndMessages test::runCLI(
|
||||
stripPreReleaseWarning(serr.str()),
|
||||
};
|
||||
}
|
||||
|
||||
string test::stripPreReleaseWarning(string const& _stderrContent)
|
||||
{
|
||||
static regex const preReleaseWarningRegex{
|
||||
R"(Warning( \(3805\))?: This is a pre-release compiler version, please do not use it in production\.\n)"
|
||||
R"((\n)?)"
|
||||
};
|
||||
static regex const noOutputRegex{
|
||||
R"(Compiler run successful, no output requested\.\n)"
|
||||
};
|
||||
|
||||
string output = regex_replace(_stderrContent, preReleaseWarningRegex, "");
|
||||
return regex_replace(std::move(output), noOutputRegex, "");
|
||||
}
|
||||
|
@ -67,6 +67,4 @@ OptionsReaderAndMessages runCLI(
|
||||
std::string const& _standardInputContent = ""
|
||||
);
|
||||
|
||||
std::string stripPreReleaseWarning(std::string const& _stderrContent);
|
||||
|
||||
} // namespace solidity::frontend::test
|
||||
|
Loading…
Reference in New Issue
Block a user