mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Update unit testing command line parser parameters:
A string passed by the '--unittest-arg' command line parameter is passed to suites when unit tests run and can be used to customize test behavior. * Add '--unittest-arg' command line argument * Remove obsolete '--unittest-format' command line argument
This commit is contained in:
committed by
Nik Bougalis
parent
4ceba603e4
commit
3e1fc9ba6c
@@ -136,7 +136,7 @@ setupConfigForUnitTests (Config* config)
|
||||
|
||||
static
|
||||
int
|
||||
runUnitTests (std::string pattern, std::string format)
|
||||
runUnitTests(std::string const& pattern, std::string const& argument)
|
||||
{
|
||||
// Config needs to be set up before creating Application
|
||||
setupConfigForUnitTests (&getConfig ());
|
||||
@@ -145,6 +145,7 @@ runUnitTests (std::string pattern, std::string format)
|
||||
using namespace beast::unit_test;
|
||||
beast::debug_ostream stream;
|
||||
reporter r (stream);
|
||||
r.arg(argument);
|
||||
bool const failed (r.run_each_if (
|
||||
global_suites(), match_auto (pattern)));
|
||||
if (failed)
|
||||
@@ -190,7 +191,7 @@ int run (int argc, char** argv)
|
||||
("rpc_port", po::value <int> (), "Specify the port number for RPC command.")
|
||||
("standalone,a", "Run with no peers.")
|
||||
("unittest,u", po::value <std::string> ()->implicit_value (""), "Perform unit tests.")
|
||||
("unittest-format", po::value <std::string> ()->implicit_value ("text"), "Format unit test output. Choices are 'text', 'junit'")
|
||||
("unittest-arg", po::value <std::string> ()->implicit_value (""), "Supplies argument to unit tests.")
|
||||
("parameters", po::value< vector<string> > (), "Specify comma separated parameters.")
|
||||
("quiet,q", "Reduce diagnotics.")
|
||||
("quorum", po::value <int> (), "Set the validation quorum.")
|
||||
@@ -279,12 +280,12 @@ int run (int argc, char** argv)
|
||||
//
|
||||
if (vm.count ("unittest"))
|
||||
{
|
||||
std::string format;
|
||||
std::string argument;
|
||||
|
||||
if (vm.count ("unittest-format"))
|
||||
format = vm ["unittest-format"].as <std::string> ();
|
||||
if (vm.count("unittest-arg"))
|
||||
argument = vm["unittest-arg"].as<std::string>();
|
||||
|
||||
return runUnitTests (vm ["unittest"].as <std::string> (), format);
|
||||
return runUnitTests(vm["unittest"].as<std::string>(), argument);
|
||||
}
|
||||
|
||||
if (!iResult)
|
||||
|
||||
Reference in New Issue
Block a user