update boost on linux
This commit is contained in:
@@ -109,12 +109,12 @@ struct parameter_trie {
|
||||
// ************** runtime::cla::report_foreing_token ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
static void
|
||||
static void
|
||||
report_foreing_token( cstring program_name, cstring token )
|
||||
{
|
||||
std::cerr << "Boost.Test WARNING: token \"" << token << "\" does not correspond to the Boost.Test argument \n"
|
||||
<< " and should be placed after all Boost.Test arguments and the -- separator.\n"
|
||||
<< " For example: " << program_name << " --random -- " << token << "\n";
|
||||
<< " For example: " << program_name << " --random -- " << token << "\n";
|
||||
}
|
||||
|
||||
} // namespace rt_cla_detail
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
|
||||
if( negative_form ) {
|
||||
BOOST_TEST_I_ASSRT( found_id.m_negatable,
|
||||
format_error( found_param->p_name )
|
||||
format_error( found_param->p_name )
|
||||
<< "Parameter tag " << found_id.m_tag << " is not negatable." );
|
||||
|
||||
curr_token.trim_left( m_negation_prefix.size() );
|
||||
@@ -211,13 +211,18 @@ public:
|
||||
|
||||
curr_token.trim_left( name.size() );
|
||||
|
||||
bool should_go_to_next = true;
|
||||
cstring value;
|
||||
|
||||
|
||||
// Skip validations if parameter has optional value and we are at the end of token
|
||||
if( !value_separator.is_empty() || !found_param->p_has_optional_value ) {
|
||||
|
||||
// we are given a separator or there is no optional value
|
||||
|
||||
// Validate and skip value separator in the input
|
||||
BOOST_TEST_I_ASSRT( found_id.m_value_separator == value_separator,
|
||||
format_error( found_param->p_name )
|
||||
format_error( found_param->p_name )
|
||||
<< "Invalid separator for the parameter "
|
||||
<< found_param->p_name
|
||||
<< " in the argument " << tr.current_token() );
|
||||
@@ -237,6 +242,40 @@ public:
|
||||
<< found_param->p_name
|
||||
<< " in the argument " << tr.current_token() );
|
||||
}
|
||||
else if( (value_separator.is_empty() && found_id.m_value_separator.empty()) ) {
|
||||
// Deduce value source
|
||||
value = curr_token;
|
||||
if( value.is_empty() ) {
|
||||
tr.next_token(); // tokenization broke the value, we check the next one
|
||||
|
||||
if(!found_param->p_has_optional_value) {
|
||||
// there is no separator and there is no optional value
|
||||
// we look for the value on the next token
|
||||
// example "-t XXXX" (no default)
|
||||
// and we commit this value as being the passed value
|
||||
value = tr.current_token();
|
||||
}
|
||||
else {
|
||||
// there is no separator and the value is optional
|
||||
// we check the next token
|
||||
// example "-c" (defaults to true)
|
||||
// and commit this as the value if this is not a token
|
||||
cstring value_check = tr.current_token();
|
||||
|
||||
cstring prefix_test, name_test, value_separator_test;
|
||||
bool negative_form_test;
|
||||
if( validate_token_format( value_check, prefix_test, name_test, value_separator_test, negative_form_test )
|
||||
&& m_param_trie[prefix_test]) {
|
||||
// this is a token, we consume what we have
|
||||
should_go_to_next = false;
|
||||
}
|
||||
else {
|
||||
// this is a value, we commit it
|
||||
value = value_check;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate against argument duplication
|
||||
BOOST_TEST_I_ASSRT( !res.has( found_param->p_name ) || found_param->p_repeatable,
|
||||
@@ -248,7 +287,9 @@ public:
|
||||
// Produce argument value
|
||||
found_param->produce_argument( value, negative_form, res );
|
||||
|
||||
tr.next_token();
|
||||
if(should_go_to_next) {
|
||||
tr.next_token();
|
||||
}
|
||||
}
|
||||
|
||||
// generate the remainder and return it's size
|
||||
@@ -273,7 +314,7 @@ public:
|
||||
<< BOOST_VERSION % 100 ;
|
||||
ostr << " with ";
|
||||
#if defined(BOOST_TEST_INCLUDED)
|
||||
ostr << "single header inclusion of";
|
||||
ostr << "header-only inclusion of";
|
||||
#elif defined(BOOST_TEST_DYN_LINK)
|
||||
ostr << "dynamic linking to";
|
||||
#else
|
||||
@@ -287,57 +328,119 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
usage( std::ostream& ostr, cstring param_name = cstring() )
|
||||
usage(std::ostream& ostr,
|
||||
cstring param_name = cstring(),
|
||||
bool use_color = true)
|
||||
{
|
||||
namespace utils = unit_test::utils;
|
||||
namespace ut_detail = unit_test::ut_detail;
|
||||
|
||||
if( !param_name.is_empty() ) {
|
||||
basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second;
|
||||
param->usage( ostr, m_negation_prefix );
|
||||
}
|
||||
else {
|
||||
ostr << "Usage: " << m_program_name << " [Boost.Test argument]... ";
|
||||
if( !m_end_of_param_indicator.empty() )
|
||||
ostr << m_end_of_param_indicator << " [custom test module argument]...";
|
||||
ostr << "\n";
|
||||
ostr << "\n The program '" << m_program_name << "' is a Boost.Test module containing unit tests.";
|
||||
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
|
||||
ostr << "\n\n Usage\n ";
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
|
||||
ostr << m_program_name << " [Boost.Test argument]... ";
|
||||
}
|
||||
if( !m_end_of_param_indicator.empty() ) {
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
|
||||
ostr << '[' << m_end_of_param_indicator << " [custom test module argument]...]";
|
||||
}
|
||||
}
|
||||
|
||||
ostr << "\nFor detailed help on Boost.Test parameters use:\n"
|
||||
<< " " << m_program_name << " --help\n"
|
||||
<< "or\n"
|
||||
<< " " << m_program_name << " --help=<parameter name>\n";
|
||||
ostr << "\n\n Use\n ";
|
||||
{
|
||||
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
|
||||
ostr << m_program_name << " --help";
|
||||
}
|
||||
ostr << "\n or ";
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN );
|
||||
ostr << m_program_name << " --help=<parameter name>";
|
||||
}
|
||||
ostr << "\n for detailed help on Boost.Test parameters.\n";
|
||||
}
|
||||
|
||||
void
|
||||
help( std::ostream& ostr, parameters_store const& parameters, cstring param_name )
|
||||
help(std::ostream& ostr,
|
||||
parameters_store const& parameters,
|
||||
cstring param_name,
|
||||
bool use_color = true)
|
||||
{
|
||||
namespace utils = unit_test::utils;
|
||||
namespace ut_detail = unit_test::ut_detail;
|
||||
|
||||
if( !param_name.is_empty() ) {
|
||||
basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second;
|
||||
param->help( ostr, m_negation_prefix );
|
||||
param->help( ostr, m_negation_prefix, use_color);
|
||||
return;
|
||||
}
|
||||
|
||||
ostr << "Usage: " << m_program_name << " [Boost.Test argument]... ";
|
||||
if( !m_end_of_param_indicator.empty() )
|
||||
ostr << m_end_of_param_indicator << " [custom test module argument]...";
|
||||
usage(ostr, cstring(), use_color);
|
||||
|
||||
ostr << "\n\nBoost.Test arguments correspond to parameters listed below. "
|
||||
"All parameters are optional. You can use specify parameter value either "
|
||||
"as a command line argument or as a value of corresponding environment "
|
||||
"variable. In case if argument for the same parameter is specified in both "
|
||||
"places, command line is taking precedence. Command line argument format "
|
||||
"supports parameter name guessing, so you can use any unambiguous "
|
||||
"prefix to identify a parameter.";
|
||||
if( !m_end_of_param_indicator.empty() )
|
||||
ostr << " All the arguments after the " << m_end_of_param_indicator << " are ignored by the Boost.Test.";
|
||||
ostr << "\n\n";
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
|
||||
ostr << " Command line flags:\n";
|
||||
}
|
||||
runtime::commandline_pretty_print(
|
||||
ostr,
|
||||
" ",
|
||||
"The command line flags of Boost.Test are listed below. "
|
||||
"All parameters are optional. You can specify parameter value either "
|
||||
"as a command line argument or as a value of its corresponding environment "
|
||||
"variable. If a flag is specified as a command line argument and an environment variable "
|
||||
"at the same time, the command line takes precedence. "
|
||||
"The command line argument "
|
||||
"support name guessing, and works with shorter names as long as those are not ambiguous."
|
||||
);
|
||||
|
||||
ostr << "\n\nBoost.Test supports following parameters:\n";
|
||||
|
||||
BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, parameters.all() ) {
|
||||
basic_param_ptr param = v.second;
|
||||
|
||||
param->usage( ostr, m_negation_prefix );
|
||||
if( !m_end_of_param_indicator.empty() ) {
|
||||
ostr << "\n\n All the arguments after the '";
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW );
|
||||
ostr << m_end_of_param_indicator;
|
||||
}
|
||||
ostr << "' are ignored by Boost.Test.";
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL );
|
||||
ostr << "\n\n Environment variables:\n";
|
||||
}
|
||||
runtime::commandline_pretty_print(
|
||||
ostr,
|
||||
" ",
|
||||
"Every argument listed below may also be set by a corresponding environment"
|
||||
"variable. For an argument '--argument_x=<value>', the corresponding "
|
||||
"environment variable is 'BOOST_TEST_ARGUMENT_X=value"
|
||||
);
|
||||
|
||||
|
||||
|
||||
ostr << "\n\n The following parameters are supported:\n";
|
||||
|
||||
BOOST_TEST_FOREACH(
|
||||
parameters_store::storage_type::value_type const&,
|
||||
v,
|
||||
parameters.all() )
|
||||
{
|
||||
basic_param_ptr param = v.second;
|
||||
ostr << "\n";
|
||||
param->usage( ostr, m_negation_prefix, use_color);
|
||||
}
|
||||
|
||||
ostr << "\nUse --help=<parameter name> to display detailed help for specific parameter.\n";
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user