mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11520 from ethereum/local-streams-in-command-line-parser
Local output streams in CommandLineParser
This commit is contained in:
commit
46514ffad2
@ -70,7 +70,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#if !defined(STDERR_FILENO)
|
#if !defined(STDERR_FILENO)
|
||||||
@ -86,27 +85,21 @@ using namespace solidity::langutil;
|
|||||||
namespace solidity::frontend
|
namespace solidity::frontend
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace
|
ostream& CommandLineInterface::sout(bool _markAsUsed)
|
||||||
{
|
{
|
||||||
|
if (_markAsUsed)
|
||||||
static bool g_hasOutput = false;
|
m_hasOutput = true;
|
||||||
|
return m_sout;
|
||||||
std::ostream& sout(bool _used = true)
|
|
||||||
{
|
|
||||||
if (_used)
|
|
||||||
g_hasOutput = true;
|
|
||||||
return cout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& serr(bool _used = true)
|
ostream& CommandLineInterface::serr(bool _markAsUsed)
|
||||||
{
|
{
|
||||||
if (_used)
|
if (_markAsUsed)
|
||||||
g_hasOutput = true;
|
m_hasOutput = true;
|
||||||
return cerr;
|
return m_serr;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define cin
|
||||||
#define cout
|
#define cout
|
||||||
#define cerr
|
#define cerr
|
||||||
|
|
||||||
@ -423,7 +416,7 @@ bool CommandLineInterface::readInputFilesAndConfigureFileReader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_options.input.addStdin)
|
if (m_options.input.addStdin)
|
||||||
m_fileReader.setSource(g_stdinFileName, readUntilEnd(cin));
|
m_fileReader.setSource(g_stdinFileName, readUntilEnd(m_sin));
|
||||||
|
|
||||||
if (m_fileReader.sourceCodes().size() == 0)
|
if (m_fileReader.sourceCodes().size() == 0)
|
||||||
{
|
{
|
||||||
@ -497,11 +490,11 @@ void CommandLineInterface::createJson(string const& _fileName, string const& _js
|
|||||||
|
|
||||||
bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
|
bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
|
||||||
{
|
{
|
||||||
CommandLineParser parser;
|
CommandLineParser parser(sout(/* _markAsUsed */ false), serr(/* _markAsUsed */ false));
|
||||||
bool success = parser.parse(_argc, _argv, isatty(fileno(stdin)));
|
bool success = parser.parse(_argc, _argv, isatty(fileno(stdin)));
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
g_hasOutput = g_hasOutput || CommandLineParser::hasOutput();
|
m_hasOutput = m_hasOutput || parser.hasOutput();
|
||||||
m_options = parser.options();
|
m_options = parser.options();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -521,7 +514,7 @@ bool CommandLineInterface::processInput()
|
|||||||
{
|
{
|
||||||
string input;
|
string input;
|
||||||
if (m_options.input.standardJsonFile.empty())
|
if (m_options.input.standardJsonFile.empty())
|
||||||
input = readUntilEnd(cin);
|
input = readUntilEnd(m_sin);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -626,7 +619,7 @@ bool CommandLineInterface::compile()
|
|||||||
|
|
||||||
for (auto const& error: m_compiler->errors())
|
for (auto const& error: m_compiler->errors())
|
||||||
{
|
{
|
||||||
g_hasOutput = true;
|
m_hasOutput = true;
|
||||||
formatter.printErrorInformation(*error);
|
formatter.printErrorInformation(*error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,7 +628,7 @@ bool CommandLineInterface::compile()
|
|||||||
}
|
}
|
||||||
catch (CompilerError const& _exception)
|
catch (CompilerError const& _exception)
|
||||||
{
|
{
|
||||||
g_hasOutput = true;
|
m_hasOutput = true;
|
||||||
formatter.printExceptionInformation(_exception, "Compiler error");
|
formatter.printExceptionInformation(_exception, "Compiler error");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -669,7 +662,7 @@ bool CommandLineInterface::compile()
|
|||||||
serr() << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl;
|
serr() << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_hasOutput = true;
|
m_hasOutput = true;
|
||||||
formatter.printExceptionInformation(_error, _error.typeName());
|
formatter.printExceptionInformation(_error, _error.typeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,7 +978,7 @@ bool CommandLineInterface::assemble(
|
|||||||
|
|
||||||
for (auto const& error: stack.errors())
|
for (auto const& error: stack.errors())
|
||||||
{
|
{
|
||||||
g_hasOutput = true;
|
m_hasOutput = true;
|
||||||
formatter.printErrorInformation(*error);
|
formatter.printErrorInformation(*error);
|
||||||
}
|
}
|
||||||
if (!Error::containsOnlyWarnings(stack.errors()))
|
if (!Error::containsOnlyWarnings(stack.errors()))
|
||||||
@ -1134,7 +1127,7 @@ void CommandLineInterface::outputCompilationResults()
|
|||||||
handleNatspec(false, contract);
|
handleNatspec(false, contract);
|
||||||
} // end of contracts iteration
|
} // end of contracts iteration
|
||||||
|
|
||||||
if (!g_hasOutput)
|
if (!m_hasOutput)
|
||||||
{
|
{
|
||||||
if (!m_options.output.dir.empty())
|
if (!m_options.output.dir.empty())
|
||||||
sout() << "Compiler run successful. Artifact(s) can be found in directory " << m_options.output.dir << "." << endl;
|
sout() << "Compiler run successful. Artifact(s) can be found in directory " << m_options.output.dir << "." << endl;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <libsolidity/interface/FileReader.h>
|
#include <libsolidity/interface/FileReader.h>
|
||||||
#include <libyul/AssemblyStack.h>
|
#include <libyul/AssemblyStack.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -38,7 +39,15 @@ namespace solidity::frontend
|
|||||||
class CommandLineInterface
|
class CommandLineInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CommandLineInterface(CommandLineOptions const& _options = CommandLineOptions{}):
|
explicit CommandLineInterface(
|
||||||
|
std::istream& _sin,
|
||||||
|
std::ostream& _sout,
|
||||||
|
std::ostream& _serr,
|
||||||
|
CommandLineOptions const& _options = CommandLineOptions{}
|
||||||
|
):
|
||||||
|
m_sin(_sin),
|
||||||
|
m_sout(_sout),
|
||||||
|
m_serr(_serr),
|
||||||
m_options(_options)
|
m_options(_options)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -106,6 +115,18 @@ private:
|
|||||||
/// @arg _json json string to be written
|
/// @arg _json json string to be written
|
||||||
void createJson(std::string const& _fileName, std::string const& _json);
|
void createJson(std::string const& _fileName, std::string const& _json);
|
||||||
|
|
||||||
|
/// Returns the stream that should receive normal output. Sets m_hasOutput to true if the
|
||||||
|
/// stream has ever been used unless @arg _markAsUsed is set to false.
|
||||||
|
std::ostream& sout(bool _markAsUsed = true);
|
||||||
|
|
||||||
|
/// Returns the stream that should receive error output. Sets m_hasOutput to true if the
|
||||||
|
/// stream has ever been used unless @arg _markAsUsed is set to false.
|
||||||
|
std::ostream& serr(bool _markAsUsed = true);
|
||||||
|
|
||||||
|
std::istream& m_sin;
|
||||||
|
std::ostream& m_sout;
|
||||||
|
std::ostream& m_serr;
|
||||||
|
bool m_hasOutput = false;
|
||||||
bool m_error = false; ///< If true, some error occurred.
|
bool m_error = false; ///< If true, some error occurred.
|
||||||
FileReader m_fileReader;
|
FileReader m_fileReader;
|
||||||
std::unique_ptr<frontend::CompilerStack> m_compiler;
|
std::unique_ptr<frontend::CompilerStack> m_compiler;
|
||||||
|
@ -34,24 +34,16 @@ namespace po = boost::program_options;
|
|||||||
namespace solidity::frontend
|
namespace solidity::frontend
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool g_hasOutput = false;
|
ostream& CommandLineParser::sout()
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
{
|
||||||
|
m_hasOutput = true;
|
||||||
std::ostream& sout()
|
return m_sout;
|
||||||
{
|
|
||||||
g_hasOutput = true;
|
|
||||||
return cout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& serr(bool _used = true)
|
ostream& CommandLineParser::serr()
|
||||||
{
|
{
|
||||||
if (_used)
|
m_hasOutput = true;
|
||||||
g_hasOutput = true;
|
return m_serr;
|
||||||
return cerr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cout
|
#define cout
|
||||||
@ -185,8 +177,7 @@ static set<string> const g_metadataHashArgs
|
|||||||
g_strNone
|
g_strNone
|
||||||
};
|
};
|
||||||
|
|
||||||
[[noreturn]]
|
void CommandLineParser::printVersionAndExit()
|
||||||
static void printVersionAndExit()
|
|
||||||
{
|
{
|
||||||
sout() <<
|
sout() <<
|
||||||
"solc, the solidity compiler commandline interface" <<
|
"solc, the solidity compiler commandline interface" <<
|
||||||
@ -197,8 +188,7 @@ static void printVersionAndExit()
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]]
|
void CommandLineParser::printLicenseAndExit()
|
||||||
static void printLicenseAndExit()
|
|
||||||
{
|
{
|
||||||
sout() << otherLicenses << endl;
|
sout() << otherLicenses << endl;
|
||||||
// This is a static variable generated by cmake from LICENSE.txt
|
// This is a static variable generated by cmake from LICENSE.txt
|
||||||
@ -206,10 +196,8 @@ static void printLicenseAndExit()
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
bool checkMutuallyExclusive(boost::program_options::variables_map const& args, std::string const& _optionA, std::string const& _optionB)
|
bool CommandLineParser::checkMutuallyExclusive(boost::program_options::variables_map const& args, string const& _optionA, string const& _optionB)
|
||||||
{
|
{
|
||||||
if (args.count(_optionA) && args.count(_optionB))
|
if (args.count(_optionA) && args.count(_optionB))
|
||||||
{
|
{
|
||||||
@ -220,8 +208,6 @@ bool checkMutuallyExclusive(boost::program_options::variables_map const& args, s
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CompilerOutputs::operator==(CompilerOutputs const& _other) const noexcept
|
bool CompilerOutputs::operator==(CompilerOutputs const& _other) const noexcept
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
@ -441,7 +427,7 @@ bool CommandLineParser::parseLibraryOption(string const& _input)
|
|||||||
|
|
||||||
bool CommandLineParser::parse(int _argc, char const* const* _argv, bool interactiveTerminal)
|
bool CommandLineParser::parse(int _argc, char const* const* _argv, bool interactiveTerminal)
|
||||||
{
|
{
|
||||||
g_hasOutput = false;
|
m_hasOutput = false;
|
||||||
|
|
||||||
// Declare the supported options.
|
// Declare the supported options.
|
||||||
po::options_description desc((R"(solc, the Solidity commandline compiler.
|
po::options_description desc((R"(solc, the Solidity commandline compiler.
|
||||||
@ -1136,11 +1122,6 @@ General Information)").c_str(),
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommandLineParser::hasOutput()
|
|
||||||
{
|
|
||||||
return g_hasOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CommandLineParser::parseCombinedJsonOption()
|
bool CommandLineParser::parseCombinedJsonOption()
|
||||||
{
|
{
|
||||||
if (!m_args.count(g_strCombinedJson))
|
if (!m_args.count(g_strCombinedJson))
|
||||||
@ -1192,4 +1173,5 @@ string CommandLineParser::joinOptionNames(vector<string> const& _optionNames, st
|
|||||||
_separator
|
_separator
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace solidity::frontend
|
} // namespace solidity::frontend
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <ostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -177,6 +178,11 @@ struct CommandLineOptions
|
|||||||
class CommandLineParser
|
class CommandLineParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit CommandLineParser(std::ostream& _sout, std::ostream& _serr):
|
||||||
|
m_sout(_sout),
|
||||||
|
m_serr(_serr)
|
||||||
|
{}
|
||||||
|
|
||||||
/// Parses the command-line arguments and fills out the internal CommandLineOptions structure.
|
/// Parses the command-line arguments and fills out the internal CommandLineOptions structure.
|
||||||
/// Performs validation and prints error messages. If requested, prints usage banner, version
|
/// Performs validation and prints error messages. If requested, prints usage banner, version
|
||||||
/// or license.
|
/// or license.
|
||||||
@ -191,9 +197,8 @@ public:
|
|||||||
|
|
||||||
CommandLineOptions const& options() const { return m_options; }
|
CommandLineOptions const& options() const { return m_options; }
|
||||||
|
|
||||||
/// Returns true if any parser instance has written anything to cout or cerr since the last
|
/// Returns true if the parser has written anything to any of its output streams.
|
||||||
/// call to parse().
|
bool hasOutput() const { return m_hasOutput; }
|
||||||
static bool hasOutput();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Parses the value supplied to --combined-json.
|
/// Parses the value supplied to --combined-json.
|
||||||
@ -210,9 +215,28 @@ private:
|
|||||||
/// @return false if there are any validation errors, true otherwise.
|
/// @return false if there are any validation errors, true otherwise.
|
||||||
bool parseLibraryOption(std::string const& _input);
|
bool parseLibraryOption(std::string const& _input);
|
||||||
|
|
||||||
|
bool checkMutuallyExclusive(
|
||||||
|
boost::program_options::variables_map const& args,
|
||||||
|
std::string const& _optionA,
|
||||||
|
std::string const& _optionB
|
||||||
|
);
|
||||||
|
[[noreturn]] void printVersionAndExit();
|
||||||
|
[[noreturn]] void printLicenseAndExit();
|
||||||
size_t countEnabledOptions(std::vector<std::string> const& _optionNames) const;
|
size_t countEnabledOptions(std::vector<std::string> const& _optionNames) const;
|
||||||
static std::string joinOptionNames(std::vector<std::string> const& _optionNames, std::string _separator = ", ");
|
static std::string joinOptionNames(std::vector<std::string> const& _optionNames, std::string _separator = ", ");
|
||||||
|
|
||||||
|
/// Returns the stream that should receive normal output. Sets m_hasOutput to true if the
|
||||||
|
/// stream has ever been used.
|
||||||
|
std::ostream& sout();
|
||||||
|
|
||||||
|
/// Returns the stream that should receive error output. Sets m_hasOutput to true if the
|
||||||
|
/// stream has ever been used.
|
||||||
|
std::ostream& serr();
|
||||||
|
|
||||||
|
std::ostream& m_sout;
|
||||||
|
std::ostream& m_serr;
|
||||||
|
bool m_hasOutput = false;
|
||||||
|
|
||||||
CommandLineOptions m_options;
|
CommandLineOptions m_options;
|
||||||
|
|
||||||
/// Map of command-line arguments produced by boost::program_options.
|
/// Map of command-line arguments produced by boost::program_options.
|
||||||
|
@ -54,7 +54,7 @@ static void setDefaultOrCLocale()
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
setDefaultOrCLocale();
|
setDefaultOrCLocale();
|
||||||
solidity::frontend::CommandLineInterface cli;
|
solidity::frontend::CommandLineInterface cli(cin, cout, cerr);
|
||||||
if (!cli.parseArguments(argc, argv))
|
if (!cli.parseArguments(argc, argv))
|
||||||
return 1;
|
return 1;
|
||||||
if (!cli.processInput())
|
if (!cli.processInput())
|
||||||
|
@ -46,7 +46,7 @@ using namespace solidity::yul;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
optional<CommandLineOptions> parseCommandLine(vector<string> const& commandLine)
|
optional<CommandLineOptions> parseCommandLine(vector<string> const& commandLine, ostream& _stdout, ostream& _stderr)
|
||||||
{
|
{
|
||||||
size_t argc = commandLine.size();
|
size_t argc = commandLine.size();
|
||||||
vector<char const*> argv(argc + 1);
|
vector<char const*> argv(argc + 1);
|
||||||
@ -57,7 +57,7 @@ optional<CommandLineOptions> parseCommandLine(vector<string> const& commandLine)
|
|||||||
for (size_t i = 0; i < argc; ++i)
|
for (size_t i = 0; i < argc; ++i)
|
||||||
argv[i] = commandLine[i].c_str();
|
argv[i] = commandLine[i].c_str();
|
||||||
|
|
||||||
CommandLineParser cliParser;
|
CommandLineParser cliParser(_stdout, _stderr);
|
||||||
bool success = cliParser.parse(
|
bool success = cliParser.parse(
|
||||||
static_cast<int>(argc),
|
static_cast<int>(argc),
|
||||||
argv.data(),
|
argv.data(),
|
||||||
@ -93,12 +93,26 @@ BOOST_AUTO_TEST_CASE(no_options)
|
|||||||
nullopt,
|
nullopt,
|
||||||
};
|
};
|
||||||
|
|
||||||
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine);
|
stringstream sout, serr;
|
||||||
|
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine, sout, serr);
|
||||||
|
|
||||||
|
BOOST_TEST(sout.str() == "");
|
||||||
|
BOOST_TEST(serr.str() == "");
|
||||||
BOOST_REQUIRE(parsedOptions.has_value());
|
BOOST_REQUIRE(parsedOptions.has_value());
|
||||||
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(help)
|
||||||
|
{
|
||||||
|
stringstream sout, serr;
|
||||||
|
optional<CommandLineOptions> parsedOptions = parseCommandLine({"solc", "--help"}, sout, serr);
|
||||||
|
|
||||||
|
BOOST_TEST(serr.str() == "");
|
||||||
|
BOOST_TEST(boost::starts_with(sout.str(), "solc, the Solidity commandline compiler."));
|
||||||
|
BOOST_TEST(sout.str().find("Usage: solc [options] [input_file...]") != string::npos);
|
||||||
|
BOOST_TEST(!parsedOptions.has_value());
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(cli_mode_options)
|
BOOST_AUTO_TEST_CASE(cli_mode_options)
|
||||||
{
|
{
|
||||||
for (InputMode inputMode: {InputMode::Compiler, InputMode::CompilerWithASTImport})
|
for (InputMode inputMode: {InputMode::Compiler, InputMode::CompilerWithASTImport})
|
||||||
@ -202,8 +216,11 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
|
|||||||
5,
|
5,
|
||||||
};
|
};
|
||||||
|
|
||||||
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine);
|
stringstream sout, serr;
|
||||||
|
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine, sout, serr);
|
||||||
|
|
||||||
|
BOOST_TEST(sout.str() == "");
|
||||||
|
BOOST_TEST(serr.str() == "");
|
||||||
BOOST_REQUIRE(parsedOptions.has_value());
|
BOOST_REQUIRE(parsedOptions.has_value());
|
||||||
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
||||||
}
|
}
|
||||||
@ -316,8 +333,11 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
|
|||||||
expectedOptions.optimizer.yulSteps = "agf";
|
expectedOptions.optimizer.yulSteps = "agf";
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine);
|
stringstream sout, serr;
|
||||||
|
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine, sout, serr);
|
||||||
|
|
||||||
|
BOOST_TEST(sout.str() == "");
|
||||||
|
BOOST_TEST(serr.str() == "Warning: Yul is still experimental. Please use the output with care.\n");
|
||||||
BOOST_REQUIRE(parsedOptions.has_value());
|
BOOST_REQUIRE(parsedOptions.has_value());
|
||||||
|
|
||||||
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
||||||
@ -388,8 +408,11 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
|
|||||||
expectedOptions.compiler.combinedJsonRequests->abi = true;
|
expectedOptions.compiler.combinedJsonRequests->abi = true;
|
||||||
expectedOptions.compiler.combinedJsonRequests->binary = true;
|
expectedOptions.compiler.combinedJsonRequests->binary = true;
|
||||||
|
|
||||||
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine);
|
stringstream sout, serr;
|
||||||
|
optional<CommandLineOptions> parsedOptions = parseCommandLine(commandLine, sout, serr);
|
||||||
|
|
||||||
|
BOOST_TEST(sout.str() == "");
|
||||||
|
BOOST_TEST(serr.str() == "");
|
||||||
BOOST_REQUIRE(parsedOptions.has_value());
|
BOOST_REQUIRE(parsedOptions.has_value());
|
||||||
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
BOOST_TEST((parsedOptions.value() == expectedOptions));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user